diff options
author | Moritz Poldrack <git@moritz.sh> | 2022-07-31 16:37:26 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-07-31 19:53:13 +0200 |
commit | 27425c15c4b96f1e11db8cc496b48f3d0fc0d3f4 (patch) | |
tree | c88a6108c719d2717450873a0e7da86fb77c86d1 /lib/ui | |
parent | ca90343850290c256430ad64daa3d809a7016299 (diff) | |
download | aerc-27425c15c4b96f1e11db8cc496b48f3d0fc0d3f4.tar.gz |
autocompletion: fix slice out of bounds access
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/ui')
-rw-r--r-- | lib/ui/textinput.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go index 8bc32b06..f09ebb43 100644 --- a/lib/ui/textinput.go +++ b/lib/ui/textinput.go @@ -70,6 +70,9 @@ func (ti *TextInput) String() string { } func (ti *TextInput) StringLeft() string { + for ti.index >= len(ti.text) { + ti.index = len(ti.text) - 1 + } return string(ti.text[:ti.index]) } |