Bug 1550901 - Prevent GeckoView PanZoomController crash when InputDevice.getDevice(event.getDeviceId()) returns null r=geckoview-reviewers,esawin
authorRandall E. Barker <rbarker@mozilla.com>
Mon, 13 May 2019 17:15:54 +0000
changeset 535518 fbcf6cd744b163f7073d8a6a00d89412b4bba9dc
parent 535517 dac784d695b31fcffe11a840c2c08e287b467ee6
child 535519 fe2f68fe25bcc83b2e0040423f931d9145f08e4a
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, esawin
bugs1550901
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1550901 - Prevent GeckoView PanZoomController crash when InputDevice.getDevice(event.getDeviceId()) returns null r=geckoview-reviewers,esawin Differential Revision: https://phabricator.services.mozilla.com/D30739
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/PanZoomController.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/PanZoomController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/PanZoomController.java
@@ -331,17 +331,18 @@ public class PanZoomController {
      */
     public boolean onMotionEvent(final @NonNull MotionEvent event) {
         ThreadUtils.assertOnUiThread();
 
         final int action = event.getActionMasked();
         if (action == MotionEvent.ACTION_SCROLL) {
             if (event.getDownTime() >= mLastDownTime) {
                 mLastDownTime = event.getDownTime();
-            } else if ((InputDevice.getDevice(event.getDeviceId()).getSources() &
+            } else if ((InputDevice.getDevice(event.getDeviceId()) != null) &&
+                       (InputDevice.getDevice(event.getDeviceId()).getSources() &
                         InputDevice.SOURCE_TOUCHPAD) == InputDevice.SOURCE_TOUCHPAD) {
                 return false;
             }
             return handleScrollEvent(event);
         } else if ((action == MotionEvent.ACTION_HOVER_MOVE) ||
                    (action == MotionEvent.ACTION_HOVER_ENTER) ||
                    (action == MotionEvent.ACTION_HOVER_EXIT)) {
             return handleMouseEvent(event);