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

Commit 9b8018ce authored by Victor Chan's avatar Victor Chan
Browse files

Null check mRecentsComponent and mDivider.

NavigationBarGestureHelper has a setter for mRecentsComponent and
mDivider. There needs to be a null check before accessing these
fields in code, since there is no guarantee setComponents() is
called.

Change-Id: I58f2c02fbf1a2d486c4c8d8db28669884d22e61a
parent 1097fa88
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -166,6 +166,9 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
        int y = (int) event.getY();
        int xDiff = Math.abs(x - mTouchDownX);
        int yDiff = Math.abs(y - mTouchDownY);
        if (mDivider == null || mRecentsComponent == null) {
            return false;
        }
        if (!mDockWindowTouchSlopExceeded) {
            boolean touchSlopExceeded = !mIsVertical
                    ? yDiff > mScrollTouchSlop && yDiff > xDiff
@@ -214,7 +217,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
    private void handleDragActionUpEvent(MotionEvent event) {
        mVelocityTracker.addMovement(event);
        mVelocityTracker.computeCurrentVelocity(1000);
        if (mDockWindowTouchSlopExceeded) {
        if (mDockWindowTouchSlopExceeded && mDivider != null && mRecentsComponent != null) {
            if (mDragMode == DRAG_MODE_DIVIDER) {
                mDivider.getView().stopDragging(mIsVertical
                                ? (int) event.getRawX()
@@ -254,7 +257,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL
        float absVelY = Math.abs(velocityY);
        boolean isValidFling = absVelX > mMinFlingVelocity &&
                mIsVertical ? (absVelY > absVelX) : (absVelX > absVelY);
        if (isValidFling) {
        if (isValidFling && mRecentsComponent != null) {
            boolean showNext;
            if (!mIsRTL) {
                showNext = mIsVertical ? (velocityY < 0) : (velocityX < 0);