summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authoryongga <yongga@codeaurora.org>2016-01-11 18:36:35 +0800
committeryongga <yongga@codeaurora.org>2016-01-11 18:36:35 +0800
commitf84c05364b088942d74f54e7eea8524fbf67948a (patch)
tree53254ac0921902d31bdbe110ad08618ba8f57d1b /src/com
parent24af2c506c4b7ad200669cc951c43f664228eac9 (diff)
downloadandroid_packages_apps_Gallery2-f84c05364b088942d74f54e7eea8524fbf67948a.tar.gz
android_packages_apps_Gallery2-f84c05364b088942d74f54e7eea8524fbf67948a.tar.bz2
android_packages_apps_Gallery2-f84c05364b088942d74f54e7eea8524fbf67948a.zip
Gallery2: Fix null pointer exception from customer monkey test.
The reference is not instantiated before invoking it. Determine whether the reference is instantiated before invoking it. Change-Id: I879877159f5b2ebe9d38e9d319d299f5b0534999 CRs-Fixed: 954744
Diffstat (limited to 'src/com')
-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;