diff options
Diffstat (limited to 'widgets/account.go')
-rw-r--r-- | widgets/account.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/widgets/account.go b/widgets/account.go index e08a2537..981a143a 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -1,6 +1,7 @@ package widgets import ( + "errors" "fmt" "log" @@ -170,8 +171,11 @@ func (acct *AccountView) SelectedAccount() *AccountView { return acct } -func (acct *AccountView) SelectedMessage() *models.MessageInfo { - return acct.msglist.Selected() +func (acct *AccountView) SelectedMessage() (*models.MessageInfo, error) { + if len(acct.msglist.Store().Uids) == 0 { + return nil, errors.New("no message selected") + } + return acct.msglist.Selected(), nil } func (acct *AccountView) SelectedMessagePart() *PartInfo { |