App crashes in don't keep activities mode
See original GitHub issueThere is a stable crash after such steps:
- Open app
- Open CreateTask screen
- Hide app
- Open app
- Hide app
The reason is in MvpConductorLifecycleListener. When there is a controller in backstack (TasksController) method postCreateView will not be invoked. So presenter equals to null. But when you press home button it invokes postDestroy method and throws NullPointerException.
com.hannesdorfmann.mosby3.conductor.sample E/AndroidRuntime: FATAL EXCEPTION: main Process: com.hannesdorfmann.mosby3.conductor.sample, PID: 1277 java.lang.RuntimeException: Unable to destroy activity {com.hannesdorfmann.mosby3.conductor.sample/com.hannesdorfmann.mosby3.conductor.sample.MainActivity}: java.lang.NullPointerException: Presenter returned from getPresenter() is null in com.hannesdorfmann.mosby3.conductor.sample.tasks.TasksController@9221574 at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4383) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4401) at android.app.ActivityThread.-wrap5(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) 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:807) Caused by: java.lang.NullPointerException: Presenter returned from getPresenter() is null in com.hannesdorfmann.mosby3.conductor.sample.tasks.TasksController@9221574 at com.hannesdorfmann.mosby3.mvp.conductor.delegate.MvpConductorLifecycleListener.postDestroy(MvpConductorLifecycleListener.java:81) at com.bluelinelabs.conductor.Controller.performDestroy(Controller.java:1076) at com.bluelinelabs.conductor.Controller.removeViewReference(Controller.java:972) at com.bluelinelabs.conductor.Controller.destroy(Controller.java:1097) at com.bluelinelabs.conductor.Controller.activityDestroyed(Controller.java:859) at com.bluelinelabs.conductor.Router.onActivityDestroyed(Router.java:558) at com.bluelinelabs.conductor.ActivityHostedRouter.onActivityDestroyed(ActivityHostedRouter.java:61) at com.bluelinelabs.conductor.internal.LifecycleHandler.destroyRouters(LifecycleHandler.java:209) at com.bluelinelabs.conductor.internal.LifecycleHandler.onDestroy(LifecycleHandler.java:160) at android.app.Fragment.performDestroy(Fragment.java:2768) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1432) at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1557) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1618) at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3027) at android.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3007) at android.app.FragmentController.dispatchDestroy(FragmentController.java:244) at android.app.Activity.performDestroy(Activity.java:7217)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Dont keep activities
is actually not simulating any real behavior that can happen in real life. Hence I wouldn’t bother.This is quite a showstopper when it comes to certain devices, can this be merged? @sockeqwe