Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't allow setSelection on invalid range #835

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,989 changes: 1,486 additions & 1,503 deletions bundle/android/App.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/android/App.js.map

Large diffs are not rendered by default.

2,999 changes: 1,491 additions & 1,508 deletions bundle/ios/App.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/ios/App.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg-mobile",
"version": "1.1.2",
"version": "1.2.0",
"private": true,
"config": {
"jsfiles": "./*.js src/*.js src/**/*.js src/**/**/*.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ private void updateSelectionIfNeeded(ReactAztecText view, @Nullable ReadableMap
if ( selection != null ) {
int start = selection.getInt("start");
int end = selection.getInt("end");
view.setSelection(start, end);
// let's make sure the selection is within a valid range
// otherwise we'd crash here - first observed with lists
// and undo/redo states as expressed in
// https://github.com/wordpress-mobile/gutenberg-mobile/issues/208#issuecomment-480246421
if (view.getText().length() >= end && start >= 0) {
view.setSelection(start, end);
}
}
}

Expand Down