summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorhuiyan <huiyan@codeaurora.org>2016-05-05 11:33:07 +0800
committerLikai Ding <likaid@codeaurora.org>2016-06-14 14:42:58 +0800
commit53796278b835579edcc04c086cedf5a954e28a67 (patch)
tree85b2d4c5e4e95db83cfc6b79a131d376152004b6 /src/com
parent77504adebce4b8bb8233eefbede7a3d2bfafd0a0 (diff)
downloadandroid_packages_apps_Gallery2-53796278b835579edcc04c086cedf5a954e28a67.tar.gz
android_packages_apps_Gallery2-53796278b835579edcc04c086cedf5a954e28a67.tar.bz2
android_packages_apps_Gallery2-53796278b835579edcc04c086cedf5a954e28a67.zip
Gallery2: Fix force close when copy pictures from PC to DUT
When copying pictures IndexOutOfBoundsException occur, and the reference is null before invoking it. Make sure the index is not out bounds. Determine whether the reference is null before invoking it. Change-Id: I35752c2fee23efd092e0bb2171d0e50cb6110bad CRs-Fixed: 1002766
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/data/ClusterAlbum.java2
-rw-r--r--src/com/android/gallery3d/ui/TimeLineSlotView.java9
2 files changed, 7 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/data/ClusterAlbum.java b/src/com/android/gallery3d/data/ClusterAlbum.java
index ceec4a4ac..b7d1c3f36 100644
--- a/src/com/android/gallery3d/data/ClusterAlbum.java
+++ b/src/com/android/gallery3d/data/ClusterAlbum.java
@@ -133,7 +133,7 @@ public class ClusterAlbum extends MediaSet implements ContentListener {
public static ArrayList<MediaItem> getMediaItemFromPath(
ArrayList<Path> paths, int start, int count,
DataManager dataManager) {
- if (start >= paths.size()) {
+ if (start >= paths.size() || start < 0) {
return new ArrayList<MediaItem>();
}
int end = Math.min(start + count, paths.size());
diff --git a/src/com/android/gallery3d/ui/TimeLineSlotView.java b/src/com/android/gallery3d/ui/TimeLineSlotView.java
index bac5a0e4d..329ea75e3 100644
--- a/src/com/android/gallery3d/ui/TimeLineSlotView.java
+++ b/src/com/android/gallery3d/ui/TimeLineSlotView.java
@@ -459,9 +459,12 @@ public class TimeLineSlotView extends GLView {
Rect offset = new Rect();
rootPane.getBoundsOf(this, offset);
Rect r = getSlotRect(slotIndex);
- r.offset(offset.left - getScrollX(),
- offset.top - getScrollY());
- return r;
+ if (r != null) {
+ r.offset(offset.left - getScrollX(),
+ offset.top - getScrollY());
+ return r;
+ }
+ return offset;
}
public int getTitleWidth() {