Bug:
7216012
If the saved state being used to restore the photo page
includes an out-of-bounds index, ignore it and reset the
index to 0.
Change-Id: I1b8aa82cbc553297189abb57bd274d7eb53f61e0
Log.w(TAG, "failed to restore " + mSetPathString);
}
if (itemPath == null) {
- if (mMediaSet.getMediaItemCount() > 0) {
+ int mediaItemCount = mMediaSet.getMediaItemCount();
+ if (mediaItemCount > 0) {
+ if (mCurrentIndex >= mediaItemCount) mCurrentIndex = 0;
itemPath = mMediaSet.getMediaItem(mCurrentIndex, 1)
.get(0).getPath();
} else {
+ // Bail out, PhotoPage can't load on an empty album
return;
}
}