Skip to content

Commit e204002

Browse files
authored
Merge pull request #1076 from wordpress-mobile/issue/1075-talkback-crash-dayone
Check for selectionStart being -1 to fix talkback crash in Day One
2 parents 1aa0a85 + 56a3798 commit e204002

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/formatting/IndentFormatter.kt

+3
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ class IndentFormatter(editor: AztecText) : AztecFormatter(editor) {
167167
* Checks whether any line of the selection can be outdented
168168
*/
169169
fun isOutdentAvailable(): Boolean {
170+
if (selectionStart == -1) {
171+
return false
172+
}
170173
val previousLineBreak = editableText.substring(0, selectionStart).lastIndexOf("\n")
171174
if (previousLineBreak > 0 && selectionCanBeOutdented(previousLineBreak + 1, selectionStart)) {
172175
return true

0 commit comments

Comments
 (0)