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>
This commit is contained in:
parent
49038aa2eb
commit
8ffcd3e5ad
1 changed files with 3 additions and 0 deletions
|
@ -176,6 +176,9 @@ func (c *Composer) setupFor(acct *AccountView) error {
|
||||||
if focusEditor != nil {
|
if focusEditor != nil {
|
||||||
c.focusable = append(c.focusable, focusEditor)
|
c.focusable = append(c.focusable, focusEditor)
|
||||||
}
|
}
|
||||||
|
if c.focused >= len(c.focusable) {
|
||||||
|
c.focused = len(c.focusable) - 1
|
||||||
|
}
|
||||||
|
|
||||||
// redraw the grid
|
// redraw the grid
|
||||||
c.updateGrid()
|
c.updateGrid()
|
||||||
|
|
Loading…
Reference in a new issue