提交 8d5372a8 编写于 作者: J Jason Simmons 提交者: GitHub

Do not try to apply selections outside the length of the text (#3845)

See https://github.com/flutter/flutter/issues/11041
上级 9d6d69fe
......@@ -137,7 +137,8 @@ public class TextInputPlugin implements MethodCallHandler {
private void applyStateToSelection(JSONObject state) throws JSONException {
int selStart = state.getInt("selectionBase");
int selEnd = state.getInt("selectionExtent");
if (selStart != -1 && selEnd != -1) {
if (selStart >= 0 && selStart <= mEditable.length() &&
selEnd >= 0 && selEnd <= mEditable.length()) {
Selection.setSelection(mEditable, selStart, selEnd);
} else {
Selection.removeSelection(mEditable);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册