diff options
author | Jake Wharton <jakewharton@gmail.com> | 2012-04-22 17:17:01 -0400 |
---|---|---|
committer | Jake Wharton <jakewharton@gmail.com> | 2012-04-23 18:54:27 -0700 |
commit | 258029eeaaace45fab6244cd09cc389aa57fedac (patch) | |
tree | 70860f57bb99af4537af271cb30b65dabbc4944a /core | |
parent | fee88fdb64cd6c0a51b11426e28a1484390d473b (diff) | |
download | frameworks_base-258029eeaaace45fab6244cd09cc389aa57fedac.zip frameworks_base-258029eeaaace45fab6244cd09cc389aa57fedac.tar.gz frameworks_base-258029eeaaace45fab6244cd09cc389aa57fedac.tar.bz2 |
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
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/FragmentManager.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 1abb7de..0519d3e 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -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); } |