Skip to content

Commit c15d7f9

Browse files
committed
Merge pull request #544 from cody-young-move/fixed_pointer_crash
In very rare cases a multi finger touch in the main section can cause an exception.
2 parents e0e18ac + f2410fb commit c15d7f9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/src/com/sothree/slidinguppanel/ViewDragHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,9 @@ private void saveLastMotion(MotionEvent ev) {
843843
final int pointerId = MotionEventCompat.getPointerId(ev, i);
844844
final float x = MotionEventCompat.getX(ev, i);
845845
final float y = MotionEventCompat.getY(ev, i);
846-
if (mLastMotionX != null && mLastMotionY != null) {
846+
// Sometimes we can try and save last motion for a pointer never recorded in initial motion. In this case we just discard it.
847+
if (mLastMotionX != null && mLastMotionY != null
848+
&& mLastMotionX.length > pointerId && mLastMotionY.length > pointerId) {
847849
mLastMotionX[pointerId] = x;
848850
mLastMotionY[pointerId] = y;
849851
}

0 commit comments

Comments
 (0)