From 6423defee1d8ccf4d462d40ae4f82c7d73b11ab5 Mon Sep 17 00:00:00 2001 From: Bobby Georgescu Date: Tue, 2 Oct 2012 11:41:25 -0700 Subject: [PATCH] Fix crash, remove logging added to diagnose bug Bug: 7216012 LocalMergeAlbum index was not being initialized in constructor so it was possible to access the index before it was populated with information. Change-Id: I7025839b0f3953b827f06c717cff6dc47a15b06c --- src/com/android/gallery3d/data/LocalMergeAlbum.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/com/android/gallery3d/data/LocalMergeAlbum.java b/src/com/android/gallery3d/data/LocalMergeAlbum.java index 14c1c6e6b..cbaf82fff 100644 --- a/src/com/android/gallery3d/data/LocalMergeAlbum.java +++ b/src/com/android/gallery3d/data/LocalMergeAlbum.java @@ -59,6 +59,7 @@ public class LocalMergeAlbum extends MediaSet implements ContentListener { for (MediaSet set : mSources) { set.addContentListener(this); } + reload(); } @Override @@ -123,17 +124,7 @@ public class LocalMergeAlbum extends MediaSet implements ContentListener { // First find the nearest mark position <= start. SortedMap head = mIndex.headMap(start + 1); - int markPos; - try { - markPos = head.lastKey(); - } catch (NoSuchElementException e) { - Log.e(TAG, "getMediaItem("+start+","+count+") failed"); - Log.e(TAG, "mSources: "); - for (MediaSet set : mSources) { - Log.e(TAG, "\t"+set.getPath()); - } - throw e; - } + int markPos = head.lastKey(); int[] subPos = head.get(markPos).clone(); MediaItem[] slot = new MediaItem[mSources.length]; -- 2.11.0