split: prevent panic when store is not set

Prevent panic when split is called but the msgstore is either not
initialized or has no UIDs. This condition could be triggered by calling
:split or :vsplit immediately at startup.

Use the same logic as the :view command, which could operate in a
similar manner.

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 15:22:32 -05:00 committed by Robin Jarry
parent c6463ba481
commit 7585a54832
1 changed files with 3 additions and 0 deletions

View File

@ -30,6 +30,9 @@ func (Split) Execute(aerc *widgets.Aerc, args []string) error {
if acct == nil {
return errors.New("No account selected")
}
if acct.Messages().Empty() {
return nil
}
n := 0
var err error
if len(args) > 1 {