From d7f2bd90300dc7569c766099d2884ae1790b3909 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 27 Feb 2021 19:02:52 +0100 Subject: [PATCH] Fix some index out of range errors Closes #601 --- pyrogram/client.py | 3 ++- pyrogram/handlers/deleted_messages_handler.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyrogram/client.py b/pyrogram/client.py index 252286a7..35153bde 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -585,7 +585,8 @@ class Client(Methods, Scaffold): {c.id: c for c in diff.chats} )) else: - self.dispatcher.updates_queue.put_nowait((diff.other_updates[0], {}, {})) + if diff.other_updates: # The other_updates list can be empty + self.dispatcher.updates_queue.put_nowait((diff.other_updates[0], {}, {})) elif isinstance(updates, raw.types.UpdateShort): self.dispatcher.updates_queue.put_nowait((updates.update, {}, {})) elif isinstance(updates, raw.types.UpdatesTooLong): diff --git a/pyrogram/handlers/deleted_messages_handler.py b/pyrogram/handlers/deleted_messages_handler.py index d57cb5ef..dff1ebe7 100644 --- a/pyrogram/handlers/deleted_messages_handler.py +++ b/pyrogram/handlers/deleted_messages_handler.py @@ -52,4 +52,4 @@ class DeletedMessagesHandler(Handler): super().__init__(callback, filters) async def check(self, client: "pyrogram.Client", messages: List[Message]): - return await super().check(client, messages[0]) + return await super().check(client, messages[0]) if messages else False # The messages list can be empty