summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2012-10-16 14:32:47 -0700
committerRaph Levien <raph@google.com>2012-10-16 14:32:47 -0700
commit8b17969c64b5d8749b901784b61dc7c165ee98be (patch)
tree9494acda4083dae6b440d621e4fa7ef1dc5770da
parent827dde0e1a0452e7aba116aa981a1229dce7038b (diff)
downloadframeworks_base-8b17969c64b5d8749b901784b61dc7c165ee98be.zip
frameworks_base-8b17969c64b5d8749b901784b61dc7c165ee98be.tar.gz
frameworks_base-8b17969c64b5d8749b901784b61dc7c165ee98be.tar.bz2
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
-rw-r--r--core/java/android/widget/TextView.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 751ed7c..8e5ff40 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6321,7 +6321,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (mDeferScroll >= 0) {
int curs = mDeferScroll;
mDeferScroll = -1;
- bringPointIntoView(curs);
+ bringPointIntoView(Math.min(curs, mText.length()));
}
if (changed && mEditor != null) mEditor.invalidateTextDisplayList();
}