about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--commands/account/search.go3
-rw-r--r--commands/msg/archive.go5
-rw-r--r--commands/msg/copy.go5
-rw-r--r--commands/msg/delete.go3
-rw-r--r--commands/msg/move.go5
-rw-r--r--commands/msg/pipe.go3
-rw-r--r--commands/msg/read.go5
-rw-r--r--commands/msg/reply.go3
8 files changed, 28 insertions, 4 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.")
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index fe391d2..63d6de0 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -41,11 +41,14 @@ func (_ Archive) Execute(aerc *widgets.Aerc, args []string) error {
 	if acct == nil {
 		return errors.New("No account selected")
 	}
+	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()
 	archiveDir := acct.AccountConfig().Archive
 	store.Next()
 	acct.Messages().Scroll()
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) {
 
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 36b8d8c..55d7f68 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -35,6 +35,9 @@ func (_ Delete) Execute(aerc *widgets.Aerc, args []string) error {
 		return errors.New("No account selected")
 	}
 	store := widget.Store()
+	if store == nil {
+		return errors.New("Cannot perform action. Messages still loading")
+	}
 	msg, err := widget.SelectedMessage()
 	if err != nil {
 		return err
diff --git a/commands/msg/move.go b/commands/msg/move.go
index 8b19a10..45fa635 100644
--- a/commands/msg/move.go
+++ b/commands/msg/move.go
@@ -49,11 +49,14 @@ func (_ Move) Execute(aerc *widgets.Aerc, args []string) error {
 	if acct == nil {
 		return errors.New("No account selected")
 	}
+	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()
 	_, isMsgView := widget.(*widgets.MessageViewer)
 	if isMsgView {
 		aerc.RemoveTab(widget)
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index 821f359..77e5d96 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -112,6 +112,9 @@ func (_ Pipe) Execute(aerc *widgets.Aerc, args []string) error {
 
 	if pipeFull {
 		store := provider.Store()
+		if store == nil {
+			return errors.New("Cannot perform action. Messages still loading")
+		}
 		msg, err := provider.SelectedMessage()
 		if err != nil {
 			return err
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) {
 
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 5295ee6..85c5d3a 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -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