Skip to content

Commit 5f45988

Browse files
author
Ziqi Chen
committed
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
1 parent e9554b0 commit 5f45988

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ boolean showMoreSuggestions() {
343343
new GestureDetector.SimpleOnGestureListener() {
344344
@Override
345345
public boolean onScroll(MotionEvent down, MotionEvent me, float deltaX, float deltaY) {
346+
if (down == null) {
347+
return false;
348+
}
346349
final float dy = me.getY() - down.getY();
347350
if (deltaY > 0 && dy < 0) {
348351
return showMoreSuggestions();

0 commit comments

Comments
 (0)