Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check null for generated fields #14

Merged
merged 2 commits into from Sep 15, 2020

Conversation

owenthereal
Copy link
Contributor

Generated fields can be null and this adds null check. An example exception
is:

I/flutter ( 6168): NoSuchMethodError: The method 'toJson' was called on
null. I/flutter ( 6168): Receiver: null I/flutter ( 6168): Tried calling:
toJson() I/flutter ( 6168): #0      Object.noSuchMethod
(dart:core-patch/object_patch.dart:51:5) I/flutter ( 6168): #1     
Message.toJson (package:tdlib/src/tdapi/objects/message.dart:120:42) 
I/flutter ( 6168): #2      UpdateNewMessage.toJson
(package:tdlib/src/tdapi/objects/update.dart:310:31) I/flutter ( 6168): #3 
   TelegramService._onEvent
(package:tdlib_example/services/telegram_service.dart:90:32) I/flutter (
6168): #4      _rootRunUnary (dart:async/zone.dart:1198:47) I/flutter (
6168): #5      _CustomZone.runUnary (dart:async/zone.dart:1100:19) 
I/flutter ( 6168): #6      _CustomZone.runUnaryGuarded
(dart:async/zone.dart:1005:7) I/flutter ( 6168): #7     
_BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11) 
I/flutter ( 6168): #8      _DelayedData.perform
(dart:async/stream_impl.dart:611:14) I/flutter ( 6168): #9     
_StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11) I/flutter
( 6168): #10     _PendingEvents.schedule.<anonymous closure>
(dart:async/stream_impl.dart:687:7) I/flutter ( 6168): #11     _rootRun
(dart:async/zone.dart:1182:47) I/flutter ( 6168): #12     _CustomZone.run
(dart:async/zone.dart:1093:19) I/flutter ( 6168): #13    
_CustomZone.runGuarded (dart:async/zone.dart:997:7) I/flutter ( 6168): #14 
  _CustomZone.bindCallbackGuarded.<ano

Generated fields can be null and this adds null check. An example
exception is:

```
I/flutter ( 6168): NoSuchMethodError: The method 'toJson' was called on null.
I/flutter ( 6168): Receiver: null
I/flutter ( 6168): Tried calling: toJson()
I/flutter ( 6168): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
I/flutter ( 6168): i-Naji#1      Message.toJson (package:tdlib/src/tdapi/objects/message.dart:120:42)
I/flutter ( 6168): i-Naji#2      UpdateNewMessage.toJson (package:tdlib/src/tdapi/objects/update.dart:310:31)
I/flutter ( 6168): i-Naji#3      TelegramService._onEvent (package:tdlib_example/services/telegram_service.dart:90:32)
I/flutter ( 6168): i-Naji#4      _rootRunUnary (dart:async/zone.dart:1198:47)
I/flutter ( 6168): i-Naji#5      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
I/flutter ( 6168): i-Naji#6      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
I/flutter ( 6168): i-Naji#7      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
I/flutter ( 6168): i-Naji#8      _DelayedData.perform (dart:async/stream_impl.dart:611:14)
I/flutter ( 6168): i-Naji#9      _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
I/flutter ( 6168): i-Naji#10     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:687:7)
I/flutter ( 6168): i-Naji#11     _rootRun (dart:async/zone.dart:1182:47)
I/flutter ( 6168): i-Naji#12     _CustomZone.run (dart:async/zone.dart:1093:19)
I/flutter ( 6168): i-Naji#13     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
I/flutter ( 6168): i-Naji#14     _CustomZone.bindCallbackGuarded.<ano
```
@i-Naji
Copy link
Owner

i-Naji commented Sep 4, 2020

sorry for my late response.
will be merged in next update with tdlib 1.6.8 libs
& thank you

@i-Naji
Copy link
Owner

i-Naji commented Sep 4, 2020

I still don't know how to solve it. I'm thinking about remove multi account support.

@i-Naji i-Naji merged commit 07f04f6 into i-Naji:master Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants