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,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):

View File

@ -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