UnifiedPush / flutter-connector

UnifiedPush connector library for flutter
Apache License 2.0
31 stars 9 forks source link

NullPointerException in onMethodCall() #93

Closed emersion closed 1 year ago

emersion commented 1 year ago

I get this sometimes:

![Screenshot_20221026-172420](https://user-images.githubusercontent.com/506932/198068365-c8c14672-2a15-4241-b47d-1bf81c17aa92.png)

My guess is that it's due to mActivity!!. Maybe we could add a fallback for mContext when mActivity is null?

p1gp1g commented 1 year ago

Do you when when it happens ? To check if the fallback is enough. We can definitely add this

emersion commented 1 year ago

It seems to happen when my app isn't running in the foreground, and its main() function gets called after a push message is received.

emersion commented 1 year ago

BTW do we really need the activity context here? Since the Android distributor selection dialog is never used (it's implemented via Flutter widgets), can't we always use mContext?

p1gp1g commented 1 year ago

What is the version of flutter-connector used by your app ?

p1gp1g commented 1 year ago

BTW do we really need the activity context here? Since the Android distributor selection dialog is never used (it's implemented via Flutter widgets), can't we always use mContext?

We can test that. The lib did use dialog on android side but not anymore indeed.

emersion commented 1 year ago
> flutter pub deps | grep unifiedpush
|-- unifiedpush 4.0.2
|   |-- unifiedpush_android 1.1.0
|   |   '-- unifiedpush_platform_interface...
|   '-- unifiedpush_platform_interface 1.0.0