Skip to content

Commit c3dde77

Browse files
committed
Fix ChatPhoto failing to parse in case the user is not known yet
1 parent 7cac352 commit c3dde77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyrogram/client/types/user_and_chats/chat_photo.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import pyrogram
2222
from pyrogram.api import types
23+
from pyrogram.errors import PeerIdInvalid
2324
from ..object import Object
2425
from ...ext.utils import encode
2526

@@ -58,7 +59,10 @@ def _parse(client, chat_photo: types.UserProfilePhoto or types.ChatPhoto, peer_i
5859
loc_small = chat_photo.photo_small
5960
loc_big = chat_photo.photo_big
6061

61-
peer = client.resolve_peer(peer_id)
62+
try:
63+
peer = client.resolve_peer(peer_id)
64+
except PeerIdInvalid:
65+
return None
6266

6367
if isinstance(peer, types.InputPeerUser):
6468
peer_id = peer.user_id

0 commit comments

Comments
 (0)