File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1616# You should have received a copy of the GNU Lesser General Public License
1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
19+ import logging
1920from collections import OrderedDict
2021from datetime import datetime
2122from io import BytesIO
2223from json import JSONEncoder , dumps
2324
2425from ..all import objects
2526
27+ log = logging .getLogger (__name__ )
28+
2629
2730class Object :
2831 all = {}
2932
3033 @staticmethod
3134 def read (b : BytesIO , * args ):
32- return Object .all [int .from_bytes (b .read (4 ), "little" )].read (b , * args )
35+ constructor_id = int .from_bytes (b .read (4 ), "little" )
36+
37+ try :
38+ return Object .all [constructor_id ].read (b , * args )
39+ except KeyError :
40+ log .error ("Unknown constructor found: {}. Full data: {}" .format (
41+ hex (constructor_id ),
42+ b .getvalue ().hex ())
43+ )
3344
3445 def write (self , * args ) -> bytes :
3546 pass
You can’t perform that action at this time.
0 commit comments