From b2786a318d8263db0aaa1ed10b2197a9f3a78d28 Mon Sep 17 00:00:00 2001 From: c_yongga Date: Tue, 5 Jan 2016 17:28:10 +0800 Subject: Gallery2: Fix IndexOutOfBoundsException when delete the images/videos The index is out of the bounds Determine whether the index is out of the bounds Change-Id: If5a2ce1496536383e00bc86676ed80a66df44e2a CRs-Fixed: 954012 --- src/com/android/gallery3d/ui/TimeLineSlotView.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/com/android/gallery3d/ui/TimeLineSlotView.java b/src/com/android/gallery3d/ui/TimeLineSlotView.java index fc764570a..dbb8a6a76 100644 --- a/src/com/android/gallery3d/ui/TimeLineSlotView.java +++ b/src/com/android/gallery3d/ui/TimeLineSlotView.java @@ -625,6 +625,10 @@ public class TimeLineSlotView extends GLView { } if (indexEnd<0) { indexEnd = (indexEnd * (- 1)) - 1; } + + if (indexStart > mHeightList.size() - 1) { + indexStart = mHeightList.size() - 1; + } int startSlotIndex = mHeightList.indexOf(mHeightList.get(indexStart)); if(indexEnd> mHeightList.size()-1) { indexEnd = mHeightList.size()-1; -- cgit v1.2.3