Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef92e7a6 authored by Leon Scroggins's avatar Leon Scroggins
Browse files

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
parent 169ae05f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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;
    }