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>
This commit is contained in:
Kevin Kuehler 2019-07-14 00:42:24 -07:00 committed by Drew DeVault
commit 8bb115dbae
8 changed files with 28 additions and 4 deletions
commands/msg

View file

@ -60,6 +60,9 @@ func (_ reply) Execute(aerc *widgets.Aerc, args []string) error {
conf := acct.AccountConfig()
us, _ := gomail.ParseAddress(conf.From)
store := widget.Store()
if store == nil {
return errors.New("Cannot perform action. Messages still loading")
}
msg, err := widget.SelectedMessage()
if err != nil {
return err