Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 258029ee authored by Jake Wharton's avatar Jake Wharton
Browse files

Fix potential NPE when saving fragment state.

If a fragment's saved view state is null and the user
visible hint is true then the `result` bundle will have
never been initialized to a value resulting in a
`NullPointerException`.

Mirrors support library change I8ba585bc6b9298841490d64bc22a8219cd261adb.

Change-Id: Iabd5ac293d2ece3771da9ef257479eca0dcd523c
parent fee88fdb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1538,6 +1538,9 @@ final class FragmentManagerImpl extends FragmentManager {
                    FragmentManagerImpl.VIEW_STATE_TAG, f.mSavedViewState);
        }
        if (!f.mUserVisibleHint) {
            if (result == null) {
                result = new Bundle();
            }
            // Only add this if it's not the default value
            result.putBoolean(FragmentManagerImpl.USER_VISIBLE_HINT_TAG, f.mUserVisibleHint);
        }