Skip to content

Commit

Permalink
ANDROID-13965 Prevent implementation from crashing in case ACTION_POI…
Browse files Browse the repository at this point in the history
…NTER_UP with an invalid pointer is received (#14)
  • Loading branch information
dpastor authored Nov 30, 2023
1 parent a8b0550 commit dff1c98
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ public void onNestedTouchEvent(@NonNull MotionEvent ev) {
}
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
/* Code not present on NestedScrollView code.
Prevent crash on last motion update due an invalid pointerId. */
if (ev.findPointerIndex(mActivePointerId) == -1) {
Log.e(TAG, "Invalid pointerId=" + mActivePointerId + " in onTouchEvent for ACTION_POINTER_UP");
break;
}
/* End of code not present on NestedScrollView code. */
mLastMotionY = (int) ev.getY(ev.findPointerIndex(mActivePointerId));
break;
}
Expand Down

0 comments on commit dff1c98

Please sign in to comment.