From 1162ee9c919127ce1a3bcc7fe0b0c275d6e616a8 Mon Sep 17 00:00:00 2001 From: zdi Date: Wed, 30 Mar 2016 17:28:17 +0800 Subject: Gallery2: Fix NullPointerException when scroll pictures in TimeLine. Fix NullPointerException when scroll pictures in TimeLine with steps: scroll pictures --> slideshow --> backpress. Change-Id: I5d43f8951aeea3bc5dabb306be5366d7db108b39 CRs-Fixed: 980466 --- src/com/android/gallery3d/ui/TimeLineSlotView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/com/android/gallery3d/ui/TimeLineSlotView.java b/src/com/android/gallery3d/ui/TimeLineSlotView.java index 5c93d31bd..81fc3a57c 100644 --- a/src/com/android/gallery3d/ui/TimeLineSlotView.java +++ b/src/com/android/gallery3d/ui/TimeLineSlotView.java @@ -107,9 +107,10 @@ public class TimeLineSlotView extends GLView { return; } Rect rect = mLayout.getSlotRect(index); - int position = (rect.top + rect.bottom - getHeight()) / 2; - - setScrollPosition(position); + if (rect != null) { + int position = (rect.top + rect.bottom - getHeight()) / 2; + setScrollPosition(position); + } } public void makeSlotVisible(int index) { -- cgit v1.2.3