aboutsummaryrefslogtreecommitdiff
path: root/widgets/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/account.go')
-rw-r--r--widgets/account.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/widgets/account.go b/widgets/account.go
index e08a253..981a143 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 {