invertase / react-native-notifee

Moved to https://github.com/invertase/notifee
https://invertase.io/blog/open-sourcing-notifee
Other
466 stars 31 forks source link

NullPointerException in app.notifee.core.ForegroundService.onStartCommand #332

Closed mars-lan closed 3 years ago

mars-lan commented 3 years ago

Getting another rare NPE with a different stacktrace from https://github.com/notifee/react-native-notifee/issues/330. Probably need to add another NPE check?

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference
app.notifee.core.ForegroundService.onStartCommand (SourceFile:1)
android.app.ActivityThread.handleServiceArgs (ActivityThread.java:3729)
android.app.ActivityThread.-wrap23 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1755)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6688)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1468)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358)
mikehardy commented 3 years ago

Indeed - sorry about that - obviously needs some more systematic testing but for this specific stack (thank you!) I've got an internal PR 97 going with a minimal change over 1.9.1 (so it's immediately merge-able, pending review by @helenaford)

In case it is useful, the PR results in this AAR if you're interested in trying it vs a known reproduction case

notifee_core_release.aar.zip

mars-lan commented 3 years ago

Thanks for the quick fix!

mikehardy commented 3 years ago

:laughing: likewise thanks for a snipe-able stack trace. NPEs are always easy, I wish the one about service timing and time allotments were as easy, still need to chew on that one and it's not going to be a simple null check unfortunately