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 2 years 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

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

stale[bot] avatar Nov 12 '22 16:11 stale[bot]

Bump

Spencer-Yoder avatar Nov 12 '22 18:11 Spencer-Yoder

The issue has been closed for inactivity.

stale[bot] avatar Nov 22 '22 20:11 stale[bot]

@yogevbd Still facing this issue, any

Will add this fix in the next release, thanks!

Any update on including the fix, we are still seeing this crash from our crash reports

ankitsingh08 avatar Jan 18 '23 14:01 ankitsingh08

@yogevbd any updates on the new release? 🙏

androideveloper avatar Jan 19 '23 09:01 androideveloper

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

Do you still receive crash reports after applying this patch?

tarouboy avatar Jan 27 '23 19:01 tarouboy

@tarouboy No more crashes since we added the patch in our postinstall process

mcapocaccia avatar Jan 27 '23 23:01 mcapocaccia

@tarouboy No more crashes since we added the patch in our postinstall process

Lovely. I will apply that patch too. Thanks man.

tarouboy avatar Jan 27 '23 23:01 tarouboy

@yogevbd @mcapocaccia Hi there, if the patch is working. why wasn't it applied to the latest releases, I'm using 7.36.0? #7769

ys-sherzad avatar Aug 29 '23 13:08 ys-sherzad

Hi All,

I am facing the same issue. But could not reproduce it even i pushed app to background. However, i have been received some mentioned error message.

Do you guys know exactly the case?

thuongtv-vn avatar Oct 05 '23 09:10 thuongtv-vn