Skip to content

Commit

Permalink
crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
odtheking committed Nov 9, 2024
1 parent d00b97a commit 8efac98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/me/odinmain/utils/ui/elements/TextInput.kt
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ class TextInput(
}

private fun insertText(str: String) {
val start = min(caretPosition, selectionStart)
val end = max(caretPosition, selectionStart)
val start = min(caretPosition, selectionStart).coerceIn(0, text.length)
val end = max(caretPosition, selectionStart).coerceIn(0, text.length)

text = text.substring(0, start) + str + text.substring(end)
caretPosition = start + str.length
Expand Down

0 comments on commit 8efac98

Please sign in to comment.