mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 12:59:46 +00:00
Catch calling .receive() when .sender is None on recv_thread
This commit is contained in:
@@ -1004,6 +1004,13 @@ class TelegramClient(TelegramBareClient):
|
||||
self._last_ping = datetime.now()
|
||||
|
||||
self._sender.receive(update_state=self.updates)
|
||||
except AttributeError:
|
||||
# 'NoneType' object has no attribute 'receive'.
|
||||
# The only moment when this can happen is reconnection
|
||||
# was triggered from another thread and the ._sender
|
||||
# was set to None, so close this thread and exit by return.
|
||||
self._recv_thread = None
|
||||
return
|
||||
except TimeoutError:
|
||||
# No problem.
|
||||
pass
|
||||
|
Reference in New Issue
Block a user