JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
88 stars 50 forks source link

[BUG] Handle Null Intents in onStartCommand #30

Closed alkebuware closed 3 years ago

alkebuware commented 3 years ago

Describe the bug I'm getting some Crash reports in Crashlytics where the onStartCommand in IsolateHolderService.kt is called with a null Intent. It seems that variable is currently non-nullable type.

Caused by java.lang.IllegalArgumentException: Parameter specified as non-null is null: method f.n.c.i.d, parameter intent at de.julianassmann.flutter_background.IsolateHolderService.onStartCommand(IsolateHolderService.java:2) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4042) at android.app.ActivityThread.-wrap21(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7425) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

To Reproduce I've actually been unable to reproduce it in my local dev environment.

Expected behavior The onStartCommand should instead take a nullable Intent type as a parameter and the intent.action call should be made null safe

Smartphone:

JulianAssmann commented 3 years ago

Should be fixed by #31 Thank you @alkebuware