From d2a3d7c286f68cc27cb9a8782127838c0e0588cd Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 16 Sep 2022 22:14:27 +0200 Subject: [PATCH] fix(irc-puppet): call to cancel() on task that might not exist (#67) --- dibridge/irc_puppet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dibridge/irc_puppet.py b/dibridge/irc_puppet.py index 7b52af9..e00e171 100644 --- a/dibridge/irc_puppet.py +++ b/dibridge/irc_puppet.py @@ -84,7 +84,8 @@ def on_disconnect(self, _client, event): self._log.warning("Disconnected from IRC") self._joined = False self._connected_event.clear() - self._pinger_task.cancel() + if self._pinger_task: + self._pinger_task.cancel() # Start a task to reconnect us. asyncio.create_task(self.connect())