From d0284c2bd3980e72855801789d47b8fbe83f92c0 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 11 May 2017 14:11:15 +0200 Subject: [PATCH] Fix is_user_authorized failing on log_out (closes #76) --- telethon/telegram_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 235609b6..05175893 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -188,7 +188,9 @@ class TelegramClient: def is_user_authorized(self): """Has the user been authorized yet (code request sent and confirmed)? Note that this will NOT yield the correct result if the session was revoked by another client!""" - return self.session.user is not None + if self.session and self.session.user is not None: + return True + return False def send_code_request(self, phone_number): """Sends a code request to the specified phone number"""