From 9963cf37b860cade6c9424d7917a4060b7ac7039 Mon Sep 17 00:00:00 2001 From: Aaron Heise <5148966+acehoss@users.noreply.github.com> Date: Tue, 28 Feb 2023 08:38:23 -0600 Subject: [PATCH] Fix exceptions on Channel shutdown --- RNS/Channel.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/RNS/Channel.py b/RNS/Channel.py index fba65e1..839bf27 100644 --- a/RNS/Channel.py +++ b/RNS/Channel.py @@ -507,13 +507,15 @@ class LinkChannelOutlet(ChannelOutletBase): def inner(receipt: RNS.PacketReceipt): callback(packet) - packet.receipt.set_timeout_callback(inner if callback else None) + if packet and packet.receipt: + packet.receipt.set_timeout_callback(inner if callback else None) def set_packet_delivered_callback(self, packet: RNS.Packet, callback: Callable[[RNS.Packet], None] | None): def inner(receipt: RNS.PacketReceipt): callback(packet) - packet.receipt.set_delivery_callback(inner if callback else None) + if packet and packet.receipt: + packet.receipt.set_delivery_callback(inner if callback else None) def get_packet_id(self, packet: RNS.Packet) -> any: return packet.get_hash()