Skip to content

Commit

Permalink
Null check when restoring saved fragment tags.
Browse files Browse the repository at this point in the history
Fixes NPE in destroyItem after restoring state saved where mSavedState.length was 0.
  • Loading branch information
rlac committed Apr 25, 2014
1 parent 97c6d1f commit 90afeed
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -218,7 +218,13 @@ public void restoreState(Parcelable state, ClassLoader loader) {
Parcelable[] fss = bundle.getParcelableArray("states");
mSavedState.clear();
mFragments.clear();
mSavedFragmentTags = bundle.getStringArrayList("tags");

ArrayList<String> tags = bundle.getStringArrayList("tags");
if (tags != null) {
mSavedFragmentTags = tags;
} else {
mSavedFragmentTags.clear();
}
if (fss != null) {
for (int i=0; i<fss.length; i++) {
mSavedState.add((Fragment.SavedState)fss[i]);
Expand Down

0 comments on commit 90afeed

Please sign in to comment.