summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/app/AlbumSetDataAdapter.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/app/AlbumSetDataAdapter.java b/src/com/android/gallery3d/app/AlbumSetDataAdapter.java
index 9086ddbf4..85f3bf532 100644
--- a/src/com/android/gallery3d/app/AlbumSetDataAdapter.java
+++ b/src/com/android/gallery3d/app/AlbumSetDataAdapter.java
@@ -355,6 +355,14 @@ public class AlbumSetDataAdapter implements AlbumSetView.Model {
if (info.version != version) {
info.version = version;
info.size = mSource.getSubMediaSetCount();
+
+ // If the size becomes smaller after reload(), we may
+ // receive from GetUpdateInfo an index which is too
+ // big. Because the main thread is not aware of the size
+ // change until we call UpdateContent.
+ if (info.index >= info.size) {
+ info.index = INDEX_NONE;
+ }
}
if (info.index != INDEX_NONE) {
info.item = mSource.getSubMediaSet(info.index);