diff options
author | Chih-Chung Chang <chihchung@google.com> | 2011-09-14 05:42:17 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-14 05:42:17 -0700 |
commit | 3e544dfd4f84483249274a7d2107a68310bdd36b (patch) | |
tree | c4dfef87b92af384f59dd44ff1cf009de432f479 /src/com/android/gallery3d/app | |
parent | 5eea58a345d419c6eda16e4500413192e78f848f (diff) | |
parent | 47d6ad0a4025be6b185639596595da7aabeb4f57 (diff) | |
download | android_packages_apps_Snap-3e544dfd4f84483249274a7d2107a68310bdd36b.tar.gz android_packages_apps_Snap-3e544dfd4f84483249274a7d2107a68310bdd36b.tar.bz2 android_packages_apps_Snap-3e544dfd4f84483249274a7d2107a68310bdd36b.zip |
Merge "Fix 5196286: Crash if the last clustered album is deleted."
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r-- | src/com/android/gallery3d/app/AlbumSetDataAdapter.java | 8 |
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); |