Index: ui/android/java/src/org/chromium/ui/base/TouchDevice.java |
diff --git a/ui/android/java/src/org/chromium/ui/base/TouchDevice.java b/ui/android/java/src/org/chromium/ui/base/TouchDevice.java |
index 440e95c8c281fcec789b123113506f856f6fc367..a5fc9793c2752c2fed43b90ce10870519357c7b1 100644 |
--- a/ui/android/java/src/org/chromium/ui/base/TouchDevice.java |
+++ b/ui/android/java/src/org/chromium/ui/base/TouchDevice.java |
@@ -57,7 +57,10 @@ public class TouchDevice { |
int pointerTypesVal = 0; |
for (int deviceId : InputDevice.getDeviceIds()) { |
- int sources = InputDevice.getDevice(deviceId).getSources(); |
+ InputDevice inputDevice = InputDevice.getDevice(deviceId); |
+ if (inputDevice == null) continue; |
+ |
+ int sources = inputDevice.getSources(); |
if (hasSource(sources, InputDevice.SOURCE_MOUSE) |
|| hasSource(sources, InputDevice.SOURCE_STYLUS) |
@@ -84,7 +87,10 @@ public class TouchDevice { |
int hoverTypesVal = 0; |
for (int deviceId : InputDevice.getDeviceIds()) { |
- int sources = InputDevice.getDevice(deviceId).getSources(); |
+ InputDevice inputDevice = InputDevice.getDevice(deviceId); |
+ if (inputDevice == null) continue; |
+ |
+ int sources = inputDevice.getSources(); |
if (hasSource(sources, InputDevice.SOURCE_MOUSE) |
|| hasSource(sources, InputDevice.SOURCE_TOUCHPAD) |