Skip to content

Commit

Permalink
Check for selectionStart being -1 to fix talkback crash in Day One
Browse files Browse the repository at this point in the history
  • Loading branch information
nbradbury committed Feb 26, 2024
1 parent 1aa0a85 commit 56a3798
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ class IndentFormatter(editor: AztecText) : AztecFormatter(editor) {
* Checks whether any line of the selection can be outdented
*/
fun isOutdentAvailable(): Boolean {
if (selectionStart == -1) {
return false
}
val previousLineBreak = editableText.substring(0, selectionStart).lastIndexOf("\n")
if (previousLineBreak > 0 && selectionCanBeOutdented(previousLineBreak + 1, selectionStart)) {
return true
Expand Down

0 comments on commit 56a3798

Please sign in to comment.