summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-01-13 16:14:06 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-01-13 16:14:06 -0800
commitf8eb04d9c75174756fb022080c3629b55c329db3 (patch)
tree2e44132485d631a4740bc4954bf0cde1ffb86cb5 /src/com/android
parentd08442293cab70a6451bfec81a4996dc01590cb8 (diff)
parentf84c05364b088942d74f54e7eea8524fbf67948a (diff)
downloadandroid_packages_apps_Gallery2-f8eb04d9c75174756fb022080c3629b55c329db3.tar.gz
android_packages_apps_Gallery2-f8eb04d9c75174756fb022080c3629b55c329db3.tar.bz2
android_packages_apps_Gallery2-f8eb04d9c75174756fb022080c3629b55c329db3.zip
Merge "Gallery2: Fix null pointer exception from customer monkey test."
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/gallery3d/ui/TimeLineSlotView.java35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/com/android/gallery3d/ui/TimeLineSlotView.java b/src/com/android/gallery3d/ui/TimeLineSlotView.java
index 2bce76865..64ee5a2d1 100644
--- a/src/com/android/gallery3d/ui/TimeLineSlotView.java
+++ b/src/com/android/gallery3d/ui/TimeLineSlotView.java
@@ -688,22 +688,25 @@ public class TimeLineSlotView extends GLView {
RectSlot rectSlot;
- int index = Arrays.binarySearch(mHeightList.toArray(new Integer[0]), absoluteY);
- if(index<0){
- index = (index*-1) -1;
- }
- if(index >= mHeightList.size()) {
- index = mHeightList.size()-1;
- }
- int startIndex = mHeightList.indexOf(mHeightList.get(index));
- int maxIndex = mHeightList.lastIndexOf(mHeightList.get(index));
- if(mMediaSlotMap.get(startIndex).mediaType == MediaObject.MEDIA_TYPE_TIMELINE_TITLE) {
- return mMediaSlotMap.get(startIndex);
- }
- for(int i= startIndex;(i< startIndex+mUnitCount) && (i<=maxIndex); i++) {
- rectSlot = mMediaSlotMap.get(i);
- if(rectSlot.slotCol== columnIdx) {
- return rectSlot;
+ if (mHeightList != null && mHeightList.size() > 0) {
+ int index = Arrays.binarySearch(mHeightList.toArray(new Integer[0]), absoluteY);
+ if (index < 0) {
+ index = (index * -1) - 1;
+ }
+ if (index >= mHeightList.size()) {
+ index = mHeightList.size() - 1;
+ }
+ int startIndex = mHeightList.indexOf(mHeightList.get(index));
+ int maxIndex = mHeightList.lastIndexOf(mHeightList.get(index));
+ if (mMediaSlotMap.get(startIndex).mediaType ==
+ MediaObject.MEDIA_TYPE_TIMELINE_TITLE) {
+ return mMediaSlotMap.get(startIndex);
+ }
+ for (int i = startIndex; (i < startIndex + mUnitCount) && (i <= maxIndex); i++) {
+ rectSlot = mMediaSlotMap.get(i);
+ if (rectSlot.slotCol == columnIdx) {
+ return rectSlot;
+ }
}
}
return null;