summary refs log tree commit diff stats
path: root/commands/account/search.go
diff options
context:
space:
mode:
authorKevin Kuehler <keur@ocf.berkeley.edu>2019-07-14 00:42:24 -0700
committerDrew DeVault <sir@cmpwn.com>2019-07-15 09:46:49 -0400
commit8bb115dbae928111be52ed422dafb1caf72a744c (patch)
tree204da9d491c9fecb87d8ff946fb0ac80a9ac2f85 /commands/account/search.go
parentd85f671bdf90dbdd725db88e5d6970630e36f9f1 (diff)
downloadaerc-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/account/search.go')
-rw-r--r--commands/account/search.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/commands/account/search.go b/commands/account/search.go
index a8640dc..0687c5b 100644
--- a/commands/account/search.go
+++ b/commands/account/search.go
@@ -51,6 +51,9 @@ func (_ SearchFilter) Execute(aerc *widgets.Aerc, args []string) error {
 		return errors.New("No account selected")
 	}
 	store := acct.Store()
+	if store == nil {
+		return errors.New("Cannot perform action. Messages still loading")
+	}
 	aerc.SetStatus("Searching...")
 	store.Search(criteria, func(uids []uint32) {
 		aerc.SetStatus("Search complete.")