From 26bf84e43d4b7777e5d622551988e676779f9523 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 14 Sep 2019 20:58:53 +0200 Subject: [PATCH] Don't try to parse ChatPhoto objects in case peer_access_hash is None --- pyrogram/client/types/user_and_chats/chat_photo.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyrogram/client/types/user_and_chats/chat_photo.py b/pyrogram/client/types/user_and_chats/chat_photo.py index 498ac72c..457754c5 100644 --- a/pyrogram/client/types/user_and_chats/chat_photo.py +++ b/pyrogram/client/types/user_and_chats/chat_photo.py @@ -55,6 +55,9 @@ class ChatPhoto(Object): if not isinstance(chat_photo, (types.UserProfilePhoto, types.ChatPhoto)): return None + if not peer_access_hash: + return None + photo_id = getattr(chat_photo, "photo_id", 0) loc_small = chat_photo.photo_small loc_big = chat_photo.photo_big