FragNav icon indicating copy to clipboard operation
FragNav copied to clipboard

3.0.0 error: savedInstanceState.getString(EXTRA_CURRENT_FRAGMENT) must not be null

Open 0megaD opened this issue 7 years ago • 2 comments

Hiya, I updated to 3.0.0 and I'm getting the following issue now in my Crashlytics:

Caused by java.lang.IllegalStateException
savedInstanceState.geString(EXTRA_CURRENT_FRAGMENT) must not be null
com.ncapdevi.fragnav.FragNavController.restoreFromBundle
com.ncapdevi.fragnav.FragNavController.restoreFromBundle (FragNavController.kt:792)
com.ncapdevi.fragnav.FragNavController.initialize (FragNavController.kt:187)
com.mycompany.myapp.activities.MainActivity.onCreate (MainActivity.java:200)

Not sure why it happens, but this is basically what I'm doing now: MainActivity (single activity app): onCreate:

        fragNavController = new FragNavController(getSupportFragmentManager(), R.id.fragment_container);
        fragNavController.setRootFragmentListener(this);
        fragNavController.initialize(FragNavController.NO_TAB, savedInstanceState);

onSaveInstanceState:

if (fragNavController != null) fragNavController.onSaveInstanceState(outState);

The fragments being pushed in the MainActivity are currently added with allowStateLoss(true), not sure if this matters.

Devices were in the foreground, and crash occurred on most Android versions.

0megaD avatar Dec 12 '18 10:12 0megaD

Any update or a temporary fix on this? Currently experiencing many crashes by this issue

dimkonomis avatar Mar 19 '19 09:03 dimkonomis

Apologies on the major delay on this. The bug report is valid and complete. I'm searching into it now to see if I can sort it out.

ncapdevi avatar Mar 19 '19 14:03 ncapdevi