Fix some index out of range errors

Closes #601
This commit is contained in:
Dan 2021-02-27 19:02:52 +01:00
parent e390aea86e
commit d7f2bd9030
2 changed files with 3 additions and 2 deletions

View File

@ -585,6 +585,7 @@ class Client(Methods, Scaffold):
{c.id: c for c in diff.chats} {c.id: c for c in diff.chats}
)) ))
else: else:
if diff.other_updates: # The other_updates list can be empty
self.dispatcher.updates_queue.put_nowait((diff.other_updates[0], {}, {})) self.dispatcher.updates_queue.put_nowait((diff.other_updates[0], {}, {}))
elif isinstance(updates, raw.types.UpdateShort): elif isinstance(updates, raw.types.UpdateShort):
self.dispatcher.updates_queue.put_nowait((updates.update, {}, {})) self.dispatcher.updates_queue.put_nowait((updates.update, {}, {}))

View File

@ -52,4 +52,4 @@ class DeletedMessagesHandler(Handler):
super().__init__(callback, filters) super().__init__(callback, filters)
async def check(self, client: "pyrogram.Client", messages: List[Message]): 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