OSDN Git Service

Prevent NPE in gesture handling.
authorAngus Kong <shkong@google.com>
Tue, 1 Oct 2013 18:32:52 +0000 (11:32 -0700)
committerAngus Kong <shkong@google.com>
Tue, 1 Oct 2013 18:32:52 +0000 (11:32 -0700)
  bug:11023769

Change-Id: Iee9e5c2d295378f327c3b01349eda5d80a579ed7

src/com/android/camera/PreviewGestures.java

index 466172b..91f5675 100644 (file)
@@ -76,6 +76,10 @@ public class PreviewGestures
 
         @Override
         public boolean onScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
+            if (e1 == null) {
+                // e1 can be null if for some cases.
+                return false;
+            }
             if (mZoomOnly || mMode == MODE_ZOOM) return false;
             int deltaX = (int) (e1.getX() - e2.getX());
             int deltaY = (int) (e1.getY() - e2.getY());