summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-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;
}