Fixed potential None reference

This commit is contained in:
Mark Qvist 2023-09-18 20:52:36 +02:00
parent 7ee9b07d9c
commit 254c966159

View File

@ -530,6 +530,7 @@ class Channel(contextlib.AbstractContextManager):
def _update_packet_timeouts(self): def _update_packet_timeouts(self):
for envelope in self._tx_ring: for envelope in self._tx_ring:
updated_timeout = self._get_packet_timeout_time(envelope.tries) updated_timeout = self._get_packet_timeout_time(envelope.tries)
if envelope.packet and envelope.packet.receipt and envelope.packet.receipt.timeout:
if updated_timeout > envelope.packet.receipt.timeout: if updated_timeout > envelope.packet.receipt.timeout:
envelope.packet.receipt.set_timeout(updated_timeout) envelope.packet.receipt.set_timeout(updated_timeout)