2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-27 12:28:09 +00:00

Fix ChatPhoto failing to parse in case the user is not known yet

This commit is contained in:
Dan 2019-09-07 15:55:58 +02:00
parent 7cac3521fe
commit c3dde77274

View File

@ -20,6 +20,7 @@ from struct import pack
import pyrogram import pyrogram
from pyrogram.api import types from pyrogram.api import types
from pyrogram.errors import PeerIdInvalid
from ..object import Object from ..object import Object
from ...ext.utils import encode from ...ext.utils import encode
@ -58,7 +59,10 @@ class ChatPhoto(Object):
loc_small = chat_photo.photo_small loc_small = chat_photo.photo_small
loc_big = chat_photo.photo_big loc_big = chat_photo.photo_big
try:
peer = client.resolve_peer(peer_id) peer = client.resolve_peer(peer_id)
except PeerIdInvalid:
return None
if isinstance(peer, types.InputPeerUser): if isinstance(peer, types.InputPeerUser):
peer_id = peer.user_id peer_id = peer.user_id