diff --git a/pyrogram/crypto/mtproto.py b/pyrogram/crypto/mtproto.py index bbe9d27a..dad30cd3 100644 --- a/pyrogram/crypto/mtproto.py +++ b/pyrogram/crypto/mtproto.py @@ -63,6 +63,9 @@ def unpack(b: BytesIO, session_id: bytes, auth_key: bytes, auth_key_id: bytes) - try: message = Message.read(data) except KeyError as e: + if e.args[0] == 0: + raise ConnectionError(f"Received empty data. Check your internet connection.") + left = data.read().hex() left = [left[i:i + 64] for i in range(0, len(left), 64)]