summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index c5c77e11b..b1736203c 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -353,10 +353,13 @@ public class PhotoPage extends ActivityState implements
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;
}
}