aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/compose.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-10-17 09:38:05 +0200
committerRobin Jarry <robin@jarry.cc>2022-10-17 22:06:50 +0200
commit8ffcd3e5adfa008f33989d4589a47ae1cd1a5e68 (patch)
tree1ea515bc26b37ce5b644cac8c6c0f0a9298d0945 /widgets/compose.go
parent49038aa2eb9748dacf0bc8fd8477f1569a8672d8 (diff)
downloadaerc-8ffcd3e5adfa008f33989d4589a47ae1cd1a5e68.tar.gz
switch-account: fix out-of-bounds panic
Fix out-of-bounds panic by updating the focused int variable when headers change in the switch-account commands. Fixes: d371c1ac8 ("commands: add switch-account command for composer") Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/compose.go')
-rw-r--r--widgets/compose.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index ae3bca13..dc0c21aa 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -176,6 +176,9 @@ func (c *Composer) setupFor(acct *AccountView) error {
if focusEditor != nil {
c.focusable = append(c.focusable, focusEditor)
}
+ if c.focused >= len(c.focusable) {
+ c.focused = len(c.focusable) - 1
+ }
// redraw the grid
c.updateGrid()