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

Commit 5f459883 authored by Ziqi Chen's avatar Ziqi Chen
Browse files

Fix crash: NPE in SuggestionStripView in LatinIME

The first parameter in `GestureDetector.OnGestureListener#onScroll` might be null, which indicates an incomplete event stream or error state. https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener#onScroll(android.view.MotionEvent,%20android.view.MotionEvent,%20float,%20float)

Bug: 383053077
Change-Id: I6e49ae353beafb6585184fa729041570991f240c
parent e9554b09
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -343,6 +343,9 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
            new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onScroll(MotionEvent down, MotionEvent me, float deltaX, float deltaY) {
            if (down == null) {
                return false;
            }
            final float dy = me.getY() - down.getY();
            if (deltaY > 0 && dy < 0) {
                return showMoreSuggestions();