Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dde15775 authored by Uday Kiran jandhyala's avatar Uday Kiran jandhyala
Browse files

Added validity check for Pointer Index

Checking if the pointer index is valid before querying for X & Y
coordinates. This is done to avoid IllegalArgumentException.

Change-Id: Ic7f3022d33c313a0bfe8b55c9bc89019b33d23b7
parent ebf33421
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -56,6 +56,11 @@ public class StackTapPointerEventListener implements PointerEventListener {
            case MotionEvent.ACTION_MOVE:
                if (mPointerId >= 0) {
                    int index = motionEvent.findPointerIndex(mPointerId);
                    if (index < 0) {
                        mPointerId = -1;
                        break;
                    }

                    if ((motionEvent.getEventTime() - motionEvent.getDownTime()) > TAP_TIMEOUT_MSEC
                            || (motionEvent.getX(index) - mDownX) > mMotionSlop
                            || (motionEvent.getY(index) - mDownY) > mMotionSlop) {