diff --git a/amqtt/mqtt/protocol/client_handler.py b/amqtt/mqtt/protocol/client_handler.py index 3fd83a27..371feb9f 100644 --- a/amqtt/mqtt/protocol/client_handler.py +++ b/amqtt/mqtt/protocol/client_handler.py @@ -163,7 +163,7 @@ async def handle_pingresp(self, pingresp: PingRespPacket): async def handle_connection_closed(self): self.logger.debug("Broker closed connection") - if not self._disconnect_waiter.done(): + if self._disconnect_waiter is not None and not self._disconnect_waiter.done(): self._disconnect_waiter.set_result(None) async def wait_disconnect(self):