summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChung-yih Wang <cywang@google.com>2011-08-18 10:58:45 +0800
committerChung-yih Wang <cywang@google.com>2011-08-18 11:00:51 +0800
commit98c85e2f5bfcaf4ab5257065a238fceb46ce754f (patch)
tree0caf609581aa4f9dc8401264c5acd455f9cdb446
parent5af9472f1c260c1a3b54d2e1bd448c27b5e5968f (diff)
downloadpackages_apps_LegacyCamera-98c85e2f5bfcaf4ab5257065a238fceb46ce754f.zip
packages_apps_LegacyCamera-98c85e2f5bfcaf4ab5257065a238fceb46ce754f.tar.gz
packages_apps_LegacyCamera-98c85e2f5bfcaf4ab5257065a238fceb46ce754f.tar.bz2
Fix the NPE.
bug:5179776 A bug caused by the boundary case. Change-Id: I8c835797725a17d1deccb3e8712bf66149cd10ab
-rw-r--r--src/com/android/camera/ui/SecondLevelIndicatorBar.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/com/android/camera/ui/SecondLevelIndicatorBar.java b/src/com/android/camera/ui/SecondLevelIndicatorBar.java
index 1ba74a9..07ff602 100644
--- a/src/com/android/camera/ui/SecondLevelIndicatorBar.java
+++ b/src/com/android/camera/ui/SecondLevelIndicatorBar.java
@@ -68,10 +68,11 @@ public class SecondLevelIndicatorBar extends IndicatorControl implements
double x = (double) event.getX();
double y = (double) event.getY();
+ int height = getHeight();
if (x > getWidth()) x = getWidth();
- if (y > getHeight()) y = getHeight();
+ if (y >= height) y = height - 1;
- int index = (int) (y * getChildCount()) / getHeight();
+ int index = (int) (y * getChildCount()) / height;
View b = getChildAt(index);
b.dispatchTouchEvent(event);
if ((mSelectedIndex != -1) && (index != mSelectedIndex)) {