From 9e28a02f6a4345ec7b5fdee68864610186f34e91 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 17 Mar 2019 14:57:05 -0400 Subject: commands: handle case where no account selected --- widgets/aerc.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'widgets/aerc.go') diff --git a/widgets/aerc.go b/widgets/aerc.go index e7eebad9..3537897d 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 } -- cgit