summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun@mapbox.com>2017-07-06 21:04:30 +0200
committerGitHub <noreply@github.com>2017-07-06 21:04:30 +0200
commit957829e8c468a7fc70653f43302a59274be8c752 (patch)
treec64ccb0b338e83ece241e17ab52cd1d5aae938ab
parent2fe3dd64c016c676d7aa35c510cf7d96df8b91dc (diff)
downloadqtlocation-mapboxgl-957829e8c468a7fc70653f43302a59274be8c752.tar.gz
[android] - validate if platform implementation doesn't return a null motion event (#9434)
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
index 3607703ab1..17eb506b97 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
@@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.maps;
import android.content.Context;
import android.graphics.PointF;
import android.location.Location;
-import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v4.view.ScaleGestureDetectorCompat;
@@ -134,7 +133,12 @@ final class MapGestureDetector {
* @param event the MotionEvent
* @return True if touch event is handled
*/
- boolean onTouchEvent(@NonNull MotionEvent event) {
+ boolean onTouchEvent(MotionEvent event) {
+ // framework can return null motion events in edge cases #9432
+ if (event == null) {
+ return false;
+ }
+
// Check and ignore non touch or left clicks
if ((event.getButtonState() != 0) && (event.getButtonState() != MotionEvent.BUTTON_PRIMARY)) {
return false;