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:
parent
d85f671bdf
commit
8bb115dbae
8 changed files with 28 additions and 4 deletions
commands/msg
|
@ -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) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue