diff options
author | Chung-yih Wang <cywang@google.com> | 2011-08-18 10:58:45 +0800 |
---|---|---|
committer | Chung-yih Wang <cywang@google.com> | 2011-08-18 11:00:51 +0800 |
commit | 98c85e2f5bfcaf4ab5257065a238fceb46ce754f (patch) | |
tree | 0caf609581aa4f9dc8401264c5acd455f9cdb446 | |
parent | 5af9472f1c260c1a3b54d2e1bd448c27b5e5968f (diff) | |
download | packages_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.java | 5 |
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)) { |