From 8bb115dbae928111be52ed422dafb1caf72a744c Mon Sep 17 00:00:00 2001 From: Kevin Kuehler Date: Sun, 14 Jul 2019 00:42:24 -0700 Subject: commands: Don't crash when store is nil On a slow network connection, running these commands without this guard will cause aerc to panic. Signed-off-by: Kevin Kuehler --- commands/msg/copy.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'commands/msg/copy.go') diff --git a/commands/msg/copy.go b/commands/msg/copy.go index 48bccd4..6bf33cd 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -44,11 +44,14 @@ func (_ Copy) Execute(aerc *widgets.Aerc, args []string) error { } widget := aerc.SelectedTab().(widgets.ProvidesMessage) + store := widget.Store() + if store == nil { + return errors.New("Cannot perform action. Messages still loading") + } msg, err := widget.SelectedMessage() if err != nil { return err } - store := widget.Store() store.Copy([]uint32{msg.Uid}, args[optind], createParents, func( msg types.WorkerMessage) { -- cgit v1.2.3