From 55f5a1a36c85ce61937ae463b050ae2a17bc6e6c Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 17 Aug 2019 22:30:34 +0200 Subject: [PATCH] Fix IndexError when parsing empty nearby chats --- pyrogram/client/methods/chats/get_nearby_chats.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyrogram/client/methods/chats/get_nearby_chats.py b/pyrogram/client/methods/chats/get_nearby_chats.py index 7f9e3614..dc0910e8 100644 --- a/pyrogram/client/methods/chats/get_nearby_chats.py +++ b/pyrogram/client/methods/chats/get_nearby_chats.py @@ -57,6 +57,9 @@ class GetNearbyChats(BaseClient): ) ) + if not r.updates: + return [] + chats = pyrogram.List([pyrogram.Chat._parse_chat(self, chat) for chat in r.chats]) peers = r.updates[0].peers