aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-10-19 15:22:32 -0500
committerRobin Jarry <robin@jarry.cc>2022-10-19 23:52:39 +0200
commit7585a54832cc045962a769b65861bf174202b891 (patch)
tree766909ad2d2ac461eba1011b27e9eb112b4af03f
parentc6463ba48167aba07b3fd8bb707dbe60707e9426 (diff)
downloadaerc-7585a54832cc045962a769b65861bf174202b891.tar.gz
aerc-7585a54832cc045962a769b65861bf174202b891.zip
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>
-rw-r--r--commands/account/split.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/commands/account/split.go b/commands/account/split.go
index 284182dc..64ca4f9e 100644
--- a/commands/account/split.go
+++ b/commands/account/split.go
@@ -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 {