From 957829e8c468a7fc70653f43302a59274be8c752 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Thu, 6 Jul 2017 21:04:30 +0200 Subject: [android] - validate if platform implementation doesn't return a null motion event (#9434) --- .../main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java | 8 ++++++-- 1 file 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; -- cgit v1.2.1