diff options
author | Kevin Kuehler <keur@ocf.berkeley.edu> | 2019-07-14 00:42:24 -0700 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-07-15 09:46:49 -0400 |
commit | 8bb115dbae928111be52ed422dafb1caf72a744c (patch) | |
tree | 204da9d491c9fecb87d8ff946fb0ac80a9ac2f85 /commands/msg/read.go | |
parent | d85f671bdf90dbdd725db88e5d6970630e36f9f1 (diff) | |
download | aerc-8bb115dbae928111be52ed422dafb1caf72a744c.tar.gz |
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 <keur@ocf.berkeley.edu>
Diffstat (limited to 'commands/msg/read.go')
-rw-r--r-- | commands/msg/read.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/commands/msg/read.go b/commands/msg/read.go index 30c6822..c6bd098 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -30,11 +30,14 @@ func (_ Read) 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.Read([]uint32{msg.Uid}, args[0] == "read", func( msg types.WorkerMessage) { |