aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZiqi Chen <czq@google.com>2024-12-11 02:39:55 -0800
committerZiqi Chen <czq@google.com>2024-12-11 02:43:32 -0800
commit5f4598831c59b0f6116ea5e63f453e07b57c2571 (patch)
tree1af43bcca83ed03cd015a05cfc45dd36f7276c97
parente9554b09a53f17104d5233cd7fdb2435299f41f8 (diff)
downloadlatinime-5f4598831c59b0f6116ea5e63f453e07b57c2571.tar.gz
latinime-5f4598831c59b0f6116ea5e63f453e07b57c2571.tar.xz
latinime-5f4598831c59b0f6116ea5e63f453e07b57c2571.zip
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
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index 840a4aa3d..5dba4928b 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -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();