Fix invalid selection/span ranges causing editor crashes#1112
Merged
Fix invalid selection/span ranges causing editor crashes#1112
Conversation
- Clamp AztecText selection to valid range to avoid framework crashes on invalid offsets - Guard span restore ranges in SuggestionWatcher and LineBlockFormatter - Add regression test for outdent-at-start crash
zwarm
approved these changes
Dec 30, 2025
Contributor
zwarm
left a comment
There was a problem hiding this comment.
@Twinsen81 . LGTM! I really like the clamping at the AztecText level and the defensive guards in the formatters should prevent the SpannableStringBuilder crashes. Nice work!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DODROID-621
Prevents crashes caused by invalid selection offsets and invalid span ranges during text mutations (e.g., outdent/indent, span restoration), which can surface as SpannableStringBuilder/selection handle failures on newer Android builds.
The crash recording:
https://github.com/user-attachments/assets/f32a42c5-fdf2-4db3-a55f-19c0b6494587
Changes:
Testing Steps
Indentbutton on the toolbarOutdentbuttonThe crashes