Skip to content

Commit

Permalink
Prevent crash when mPrevEvent is null
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas.simon committed Jan 26, 2018
1 parent 411d745 commit 7536d41
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ protected void handleInProgressEvent(int actionCode, MotionEvent event){
break;

case MotionEvent.ACTION_MOVE:
//updateStateByEvent looks for information within mPrevEvent
//However, if the gesture started before the detector was attached,
//ACTION_MOVE happens but mPrevEvent is null, and code will crash
// @BaseGestureDetector.updateStateByEvent() line 102.
//This check will simply ignore the current movement if it didn't track it from
// the start.
if (mPrevEvent == null) {
return;
}
updateStateByEvent(event);

// Only accept the event if our relative pressure is within
Expand Down

0 comments on commit 7536d41

Please sign in to comment.