Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] - validate if platform implementation doesn't return a null…
Browse files Browse the repository at this point in the history
… motion event (#9434)
  • Loading branch information
tobrun committed Jul 20, 2017
1 parent 9f2990d commit ad3b4c6
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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;
Expand Down Expand Up @@ -134,7 +133,12 @@ private Location getLocationFromGesture(float x, float y) {
* @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;
Expand Down

0 comments on commit ad3b4c6

Please sign in to comment.