summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2011-05-27 15:58:55 -0700
committerGilles Debunne <debunne@google.com>2011-05-27 16:02:40 -0700
commitd4bb0b01c6caccbaef1baec377a59c10790da35c (patch)
treeeebcdab0011ac5425fd6fc775ca726bbe4fd4434 /core/java
parent73d0a60628535cdaac5da7c4d32a8c727d6c5649 (diff)
downloadframeworks_base-d4bb0b01c6caccbaef1baec377a59c10790da35c.zip
frameworks_base-d4bb0b01c6caccbaef1baec377a59c10790da35c.tar.gz
frameworks_base-d4bb0b01c6caccbaef1baec377a59c10790da35c.tar.bz2
Fix for bug 4499752 - Detect nulled layouts in HandleViews
Change-Id: I6a7289150bf461cdf4cca0aff4aa4a0400e0d553
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/text/method/WordIterator.java3
-rw-r--r--core/java/android/widget/TextView.java7
2 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/text/method/WordIterator.java b/core/java/android/text/method/WordIterator.java
index b250414..af524ee 100644
--- a/core/java/android/text/method/WordIterator.java
+++ b/core/java/android/text/method/WordIterator.java
@@ -213,7 +213,8 @@ public class WordIterator implements Selection.PositionIterator {
private void checkOffsetIsValid(int offset) {
if (offset < 0 || offset > mCurrent.length()) {
- final String message = "Valid range is [0, " + mCurrent.length() + "]";
+ final String message = "Invalid offset: " + offset +
+ ". Valid range is [0, " + mCurrent.length() + "]";
throw new IllegalArgumentException(message);
}
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 3875765..8835a04 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -9140,6 +9140,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
public abstract void updatePosition(float x, float y);
protected void positionAtCursorOffset(int offset) {
+ // A HandleView relies on the layout, which may be nulled by external methods.
+ if (mLayout == null) {
+ // Will update controllers' state, hiding them and stopping selection mode if needed
+ prepareCursorControllers();
+ return;
+ }
+
addPositionToTouchUpFilter(offset);
final int line = mLayout.getLineForOffset(offset);
final int lineBottom = mLayout.getLineBottom(line);