bluelinelabs / bluelinelabs/Conductor
Container is null in performControllerChange when back button is pressed
- Dominant language
- Java
- Stars
- 3.9k
- Forks
- 338
- PR merge metrics
- No merged PRs in 30d
Description
We are getting a unreproducible crash report in our app that's difficult to find the cause of.
It appears the container is null when performControllerChange is called in Router.java:
```
container.post(new Runnable() {
@Override
public void run() {
performPendingControllerChanges();
}
});
```
Full stack trace:
```
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.View.post(java.lang.Runnable)' on a null object reference
at com.bluelinelabs.conductor.Router.performControllerChange(SourceFile:767)
at com.bluelinelabs.conductor.Router.performControllerChange(SourceFile:744)
at com.bluelinelabs.conductor.Router.performControllerChange(SourceFile:726)
at com.bluelinelabs.conductor.Router.popController(SourceFile:136)
at com.bluelinelabs.conductor.Router.popCurrentController(SourceFile:118)
at com.bluelinelabs.conductor.Router.handleBack(SourceFile:96)
at com.redacted.redacted.MainController.handleBack(SourceFile:147)
at com.bluelinelabs.conductor.Router.handleBack(SourceFile:94)
at com.redacted.redacted.MainActivity.onBackPressed(SourceFile:103)
at android.app.Activity.onKeyUp(Activity.java:2826)
at android.view.KeyEvent.dispatch(KeyEvent.java:2766)
at android.app.Activity.dispatchKeyEvent(Activity.java:3146)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(SourceFile:541)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(SourceFile:59)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(SourceFile:319)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:353)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4742)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4713)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4249)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4302)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4268)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4395)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4276)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4452)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4249)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4302)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4268)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4276)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4249)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4302)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4268)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4428)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4589)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2512)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2106)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2097)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2487)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:346)
at android.os.Looper.loop(Looper.java:138)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
```
I can't seem to reproduce it, so I suspect it occurs during some weird state where the back button is pressed while the container view isn't quite ready. Strangely, it gets past your containerFullyAttached check.
Have you got any idea about what state the app has to be in to cause this issue? I know changes have been made recently in this part of the library, so this may be related to #287 #285 and [this commit](https://github.com/bluelinelabs/Conductor/commit/a84b2fb4c413ad6209284f1e61332ccc2ee57474).
Contributor guide
Assessment
This issue has not been assessed yet.