diff --git a/pyrogram/methods/users/get_chat_photos.py b/pyrogram/methods/users/get_chat_photos.py index 6c34d6a5..1c1fa129 100644 --- a/pyrogram/methods/users/get_chat_photos.py +++ b/pyrogram/methods/users/get_chat_photos.py @@ -96,10 +96,16 @@ class GetChatPhotos: ) ) - extra = [message.new_chat_photo for message in r] + extra = [message.new_chat_photo for message in r] if r else [] if extra: - if current: + if ( + current + and + len(current) > 0 + and + isinstance(current[0], types.Photo) + ): photos = (current + extra) if current[0].file_id != extra[0].file_id else extra else: photos = extra @@ -111,6 +117,9 @@ class GetChatPhotos: current = 0 + if len(photos) == 0 or (len(photos) == 1 and not isinstance(photos[0], types.Photo)): + return + for photo in photos: yield photo