summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebTextView.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-09-02 17:47:29 -0400
committerLeon Scroggins <scroggo@google.com>2009-09-02 19:31:33 -0400
commitef92e7a606167130d4ae52c1e23f32c3f0af291e (patch)
tree0c5a6e8a32f5ace680783017ed5e8874ca05ff7e /core/java/android/webkit/WebTextView.java
parent169ae05f9f5cce400dd936e2a31676b80d84b862 (diff)
downloadframeworks_base-ef92e7a606167130d4ae52c1e23f32c3f0af291e.zip
frameworks_base-ef92e7a606167130d4ae52c1e23f32c3f0af291e.tar.gz
frameworks_base-ef92e7a606167130d4ae52c1e23f32c3f0af291e.tar.bz2
Prevent a crash when webkit changes the selection.
Partial fix for http://b/issue?id=2081673 This prevents a crash. However, if the user continues typing into the textfield, the selection is incorrect. The real solution (forthcoming), will make sure that the WebTextView's text gets updated when webkit updates. Change-Id: Ic832ec48fd4236c8116c5cbda1467677ad731feb
Diffstat (limited to 'core/java/android/webkit/WebTextView.java')
-rw-r--r--core/java/android/webkit/WebTextView.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index a1f2223..95b3a12 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -697,8 +697,12 @@ import java.util.ArrayList;
* Set the selection, and disable our onSelectionChanged action.
*/
/* package */ void setSelectionFromWebKit(int start, int end) {
+ if (start < 0 || end < 0) return;
+ Spannable text = (Spannable) getText();
+ int length = text.length();
+ if (start > length || end > length) return;
mFromWebKit = true;
- Selection.setSelection((Spannable) getText(), start, end);
+ Selection.setSelection(text, start, end);
mFromWebKit = false;
}