summary refs log tree commit diff stats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/cf.go3
-rw-r--r--commands/next-folder.go3
-rw-r--r--commands/next-message.go3
-rw-r--r--commands/select-message.go3
4 files changed, 12 insertions, 0 deletions
diff --git a/commands/cf.go b/commands/cf.go
index 83b757c..d8b0508 100644
--- a/commands/cf.go
+++ b/commands/cf.go
@@ -20,6 +20,9 @@ func ChangeFolder(aerc *widgets.Aerc, args []string) error {
 		return errors.New("Usage: cf <folder>")
 	}
 	acct := aerc.SelectedAccount()
+	if acct == nil {
+		return errors.New("No account selected")
+	}
 	previous := acct.Directories().Selected()
 	if args[1] == "-" {
 		if dir, ok := history[acct.Name()]; ok {
diff --git a/commands/next-folder.go b/commands/next-folder.go
index dce8907..f0332c6 100644
--- a/commands/next-folder.go
+++ b/commands/next-folder.go
@@ -32,6 +32,9 @@ func NextPrevFolder(aerc *widgets.Aerc, args []string) error {
 		}
 	}
 	acct := aerc.SelectedAccount()
+	if acct == nil {
+		return errors.New("No account selected")
+	}
 	for ; n > 0; n-- {
 		if args[0] == "prev-folder" {
 			acct.Directories().Prev()
diff --git a/commands/next-message.go b/commands/next-message.go
index 8639973..d1d188c 100644
--- a/commands/next-message.go
+++ b/commands/next-message.go
@@ -38,6 +38,9 @@ func NextPrevMessage(aerc *widgets.Aerc, args []string) error {
 		}
 	}
 	acct := aerc.SelectedAccount()
+	if acct == nil {
+		return errors.New("No account selected")
+	}
 	if pct {
 		n = int(float64(acct.Messages().Height()) * (float64(n) / 100.0))
 	}
diff --git a/commands/select-message.go b/commands/select-message.go
index 868d1fd..728d31b 100644
--- a/commands/select-message.go
+++ b/commands/select-message.go
@@ -26,6 +26,9 @@ func SelectMessage(aerc *widgets.Aerc, args []string) error {
 		}
 	}
 	acct := aerc.SelectedAccount()
+	if acct == nil {
+		return errors.New("No account selected")
+	}
 	acct.Messages().Select(n)
 	return nil
 }