split: prevent opening split when no messages are selected

The [v]split command panics when it is run with no message selected, or
when messages aren't loaded. Check for a valid selected message before
creating a split, and report an error if one isn't selected.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Tim Culverhouse 2022-10-19 14:28:50 -05:00 committed by Robin Jarry
parent ee964ad6b0
commit bd8a4feecc
2 changed files with 18 additions and 10 deletions
commands/account

View file

@ -55,9 +55,7 @@ func (Split) Execute(aerc *widgets.Aerc, args []string) error {
n = 0
}
if args[0] == "split" {
acct.Split(n)
return nil
return acct.Split(n)
}
acct.Vsplit(n)
return nil
return acct.Vsplit(n)
}