sockeqwe/mosby-conductor

NPE with Activity#isChangingConfigurations

jbiral opened this issue · 6 comments

When the app is stopped and restarted quickly, I intermittently get into this state:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.Activity.isChangingConfigurations()' on a null object reference
       at com.hannesdorfmann.mosby3.mvp.conductor.delegate.MvpConductorLifecycleListener.preDestroyView(MvpConductorLifecycleListener.java:73)
       at com.bluelinelabs.conductor.Controller.removeViewReference(Controller.java:898)
       at com.bluelinelabs.conductor.Controller.detach(Controller.java:886)
       at com.bluelinelabs.conductor.Controller$8.onDetached(Controller.java:965)
       at com.bluelinelabs.conductor.internal.ViewAttachHandler.reportDetached(ViewAttachHandler.java:103)
       at com.bluelinelabs.conductor.internal.ViewAttachHandler.onViewDetachedFromWindow(ViewAttachHandler.java:58)
       at android.view.View.dispatchDetachedFromWindow(View.java:16782)
       at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3429)
       at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3421)
       at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3421)
       at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3421)
       at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3421)
       at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3421)
       at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3421)
       at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3421)
       at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3718)
       at android.view.ViewRootImpl.doDie(ViewRootImpl.java:6691)
       at android.view.ViewRootImpl.die(ViewRootImpl.java:6668)
       at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:476)
       at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:414)
       at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:128)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4683)
       at android.app.ActivityThread.-wrap7(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1703)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6776)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

I don't think there is much I can do since it seems to be internal to the library. Could you please investigate?

Thanks, I have open the issue on Conductor too. I don't have any good way to repro this, unfortunately. I use MvpController as my base Controller class, and sometimes we've seen this crash. I will keep you updated if I can get to know more about it.

I have 9 crashes in my Firebase console with exactly this stack trace.
Judging from analytics events which in my case get attached to the crashes, this happens when user opens some activity and then presses "back" button.

I am not able to reproduce this manually either...

Mosby Conductor version is 3.0.0, Conductor version is 2.1.4

I have the same issue on about 0.5 % of my users in 1 of my apps. I can't reproduce it either.
I have informed Erik about that issue. bluelinelabs/Conductor#315

I went through the source code. There is very little Mosby can do here, it seems like am conductor bug but couldn't reproduce it.

I see, thanks, will folow that issue too.