Skip to content

Commit dff1c98

Browse files
authored
ANDROID-13965 Prevent implementation from crashing in case ACTION_POINTER_UP with an invalid pointer is received (#14)
1 parent a8b0550 commit dff1c98

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

nestedscrollwebview/src/main/java/com/telefonica/nestedscrollwebview/NestedScrollWebView.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ public void onNestedTouchEvent(@NonNull MotionEvent ev) {
365365
}
366366
case MotionEvent.ACTION_POINTER_UP:
367367
onSecondaryPointerUp(ev);
368+
/* Code not present on NestedScrollView code.
369+
Prevent crash on last motion update due an invalid pointerId. */
370+
if (ev.findPointerIndex(mActivePointerId) == -1) {
371+
Log.e(TAG, "Invalid pointerId=" + mActivePointerId + " in onTouchEvent for ACTION_POINTER_UP");
372+
break;
373+
}
374+
/* End of code not present on NestedScrollView code. */
368375
mLastMotionY = (int) ev.getY(ev.findPointerIndex(mActivePointerId));
369376
break;
370377
}

0 commit comments

Comments
 (0)