summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-17 14:57:05 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-17 14:57:05 -0400
commit9e28a02f6a4345ec7b5fdee68864610186f34e91 (patch)
tree866940888523f3cafa649697d088c4e016014662 /widgets
parentbd71787e3fa9caf53f18dab37c4f37a2631b2354 (diff)
downloadaerc-9e28a02f6a4345ec7b5fdee68864610186f34e91.tar.gz
commands: handle case where no account selected
Diffstat (limited to 'widgets')
-rw-r--r--widgets/aerc.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index e7eebad..3537897 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -80,5 +80,9 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
 }
 
 func (aerc *Aerc) SelectedAccount() *AccountView {
-	return aerc.accounts[aerc.tabs.Tabs[aerc.tabs.Selected].Name]
+	acct, ok := aerc.accounts[aerc.tabs.Tabs[aerc.tabs.Selected].Name]
+	if !ok {
+		return nil
+	}
+	return acct
 }