Skip to content

Commit

Permalink
Fix crash: NPE in SuggestionStripView in LatinIME
Browse files Browse the repository at this point in the history
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
Google: 3405839
Change-Id: I6e49ae353beafb6585184fa729041570991f240c
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Pranav Temkar <pranavtemkar@gmail.com>
  • Loading branch information
Ziqi Chen authored and PptO07 committed Jan 16, 2025
1 parent 64927e7 commit 522b3ae
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ boolean showMoreSuggestions() {
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();
Expand Down

0 comments on commit 522b3ae

Please sign in to comment.