diff options
author | Michael W <baddaemon87@gmail.com> | 2017-07-12 14:16:42 +0200 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2017-12-16 06:52:43 +0100 |
commit | 6b9ce51b6e79538328f6d6aa0d6b2254c7b36c2a (patch) | |
tree | 495da7bd49e1c57415468a6a53c2e035fe66e832 | |
parent | 7a796df49c42d88ecf04c4075b2fd2c12e431007 (diff) | |
download | android_packages_apps_Gallery2-6b9ce51b6e79538328f6d6aa0d6b2254c7b36c2a.tar.gz android_packages_apps_Gallery2-6b9ce51b6e79538328f6d6aa0d6b2254c7b36c2a.tar.bz2 android_packages_apps_Gallery2-6b9ce51b6e79538328f6d6aa0d6b2254c7b36c2a.zip |
Gallery2: Fix potential crash
* A race between deleting and displaying videos seems to report a higher
count of videos available than actually accessible.
BUGBASH-489
Change-Id: Iac24002feb8701cc4182c3834f663be017b625d5
-rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 7f947d8f3..080dfbab4 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -652,9 +652,14 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster if (mMediaSet == null) return false; int count = mMediaSet.getMediaItemCount(); + ArrayList<MediaItem> list; MediaItem item; for (int i = 0; i < count; i++) { - item = mMediaSet.getMediaItem(i, 1).get(0); + list = mMediaSet.getMediaItem(i, 1); + if (list == null) { + continue; + } + item = list.get(0); if (item == null) { continue; } |