Fix array out of bounds error

This commit is contained in:
burrowing-owl 2020-05-04 12:59:31 -04:00 committed by Reto Brunner
parent 05fa79eb8e
commit 866cd17dd7

View file

@ -181,7 +181,7 @@ func (ti *TextInput) insert(ch rune) {
func (ti *TextInput) deleteWord() {
// TODO: Break on any of / " '
if len(ti.text) == 0 {
if len(ti.text) == 0 || ti.index <= 0 {
return
}
i := ti.index - 1