Skip to content

Commit 8b17969

Browse files
committed
Fix for bug 7358703 Gmail ANR when trying to compose a message
When deferring scroll to a point, it's possible the text changed between the time the scroll was requested to the time layout happens. In this case, it attempts to scroll to a point past the end of the text buffer, which created an infinite loop. This patch clamps the scroll offset to the length of the text, so it just scrolls to the end in that case, rather than crashing. Change-Id: I53740d119d588560f5a4d9fb80e38f7057faab89
1 parent 827dde0 commit 8b17969

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/java/android/widget/TextView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6321,7 +6321,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
63216321
if (mDeferScroll >= 0) {
63226322
int curs = mDeferScroll;
63236323
mDeferScroll = -1;
6324-
bringPointIntoView(curs);
6324+
bringPointIntoView(Math.min(curs, mText.length()));
63256325
}
63266326
if (changed && mEditor != null) mEditor.invalidateTextDisplayList();
63276327
}

0 commit comments

Comments
 (0)