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

Commit 255b008a authored by Adam Powell's avatar Adam Powell
Browse files

Fix NPE for Fragment#setUserVisibleHint(true)

Fix a bug where calling setUserVisibleHint(true) before adding a
Fragment to a FragmentManager could cause a crash.

Bug 27250018

Change-Id: Id192ae31bab95f15d32de9f105e707bdb8691641
parent 24f62ea6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1033,7 +1033,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
     *                        false if it is not.
     */
    public void setUserVisibleHint(boolean isVisibleToUser) {
        if (!mUserVisibleHint && isVisibleToUser && mState < STARTED) {
        if (!mUserVisibleHint && isVisibleToUser && mState < STARTED && mFragmentManager != null) {
            mFragmentManager.performPendingDeferredStart(this);
        }
        mUserVisibleHint = isVisibleToUser;