react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

java.lang.NullPointerException: Attempt to invoke virtual method 'h.g.k.g.f h.g.b.d()' on a null object reference

Open DenisPostnikov opened this issue 1 year ago • 5 comments

Hey there,

here's the stacktrace of the issue:

StackTrace

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'h.g.k.g.f h.g.b.d()' on a null object reference at com.reactnativenavigation.react.NavigationModule.navigator(NavigationModule.java:4) at com.reactnativenavigation.react.NavigationModule.access$100(NavigationModule.java) at com.reactnativenavigation.react.NavigationModule$1.lambda$onHostPause$0(NavigationModule.java:2) at com.reactnativenavigation.react.-$$Lambda$NavigationModule$1$YAogg-YWvGlqmTQTIc1m0ewJv3s.run(-.java:2) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8167) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

Environment

  • React Native Navigation version: "^7.29.0"
  • React Native version:"0.66.3"
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): samsung Galaxy S9, Release

DenisPostnikov avatar Sep 02 '22 07:09 DenisPostnikov

Many crashes here too, same RNN and RN versions.

Crash is in NavigationModule.java:213

private Navigator navigator() {
    return activity().getNavigator();
}

This is the context:

  • app goes to background
  • activity gets destroyed
  • getCurrentActivity returns null, so "activity()" above is null
  • crash

mcapocaccia avatar Sep 06 '22 14:09 mcapocaccia

Same problem here.

marf avatar Sep 07 '22 15:09 marf

I got crash like above FATAL EXCEPTION: main Process, PID: 23622 java.lang.NullPointerException: Attempt to invoke virtual method 'f.i.k.g.f f.i.b.N()' on a null object reference at com.reactnativenavigation.react.NavigationModule.navigator(NavigationModule.java:1) at com.reactnativenavigation.react.NavigationModule.access$100(NavigationModule.java:1) at com.reactnativenavigation.react.NavigationModule$a.a(NavigationModule.java:1) at com.reactnativenavigation.react.NavigationModule$a.b(Unknown Source:0) at com.reactnativenavigation.react.b.run(Unknown Source:2) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6523) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)

RaviMopo avatar Sep 12 '22 14:09 RaviMopo

We patched with the diff below in postinstall and the crash disappeared completely. @guyca @yogevbd it is a quite safe modification, you could consider patching 7.30.x

react-native-navigation+7.29.0.patch.zip

mcapocaccia avatar Sep 13 '22 14:09 mcapocaccia

Will add this fix in the next release, thanks!

yogevbd avatar Sep 14 '22 12:09 yogevbd

Will add this fix in the next release, thanks!

@yogevbd Is there any ETA on when the next version is going to be release?

SYoder1 avatar Oct 13 '22 13:10 SYoder1