carp-dk / carp-dk/flutter-plugins

activity_recognition_flutter 4.0.5+1

Open
#449 0 comments 0 reactions 0 assignees View on GitHub
bugfix
Dominant language
Dart
Stars
608
Forks
735
Avg merge
1m
Merged PRs (30d)
3

Description

### Device / Emulator and OS
Android - several models Android 9 - 11

### Describe the bug
Quitting and reloading an application with this plugin crashes periodically on load. Some devices experience this more often than others - maybe only loading successfully once every 4-5 attempts.

Logs show:

```
java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.EventChannel$EventSink.success(java.lang.Object)' on a null object reference
at dk.cachet.activity_recognition_flutter.ActivityRecognitionFlutterPlugin.onSharedPreferenceChanged(ActivityRecognitionFlutterPlugin.java:167)
at android.app.SharedPreferencesImpl$EditorImpl.notifyListeners(SharedPreferencesImpl.java:607)
at android.app.SharedPreferencesImpl$EditorImpl.lambda$notifyListeners$0(SharedPreferencesImpl.java:613)
at android.app.-$$Lambda$SharedPreferencesImpl$EditorImpl$3CAjkhzA131V3V-sLfP2uy0FWZ0.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7156)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
```
Looking into the code it is eventSink that is null.

Would expect it to load without crashing. Note debugging the app connected to the computer loads fine every time, its only when quitting the app and launching from the device itself that this issue occurs. Happens in both release and debug builds installed via apk if that makes any difference.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.