Skip to content

Commit 942202f

Browse files
authored
Fix pointerIndex out of range exception
1 parent 39b38c5 commit 942202f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

parallaxbacklayout/src/main/java/com/github/anzewei/parallaxbacklayout/ViewDragHelper.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,9 @@ public void processTouchEvent(MotionEvent ev) {
12261226
case MotionEvent.ACTION_MOVE: {
12271227
if (mDragState == STATE_DRAGGING) {
12281228
final int index = ev.findPointerIndex(mActivePointerId);
1229+
if (ev.getPointerCount() <= index || index < 0){
1230+
return;
1231+
}
12291232
final float x = ev.getX( index);
12301233
final float y = ev.getY(index);
12311234
final int idx = (int) (x - mLastMotionX[mActivePointerId]);
@@ -1580,4 +1583,4 @@ private int getEdgeTouched(int x, int y) {
15801583

15811584
return result;
15821585
}
1583-
}
1586+
}

0 commit comments

Comments
 (0)