diff options
author | Tom Lebreux <tomlebreux@cock.li> | 2019-04-08 23:14:14 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-04-10 15:40:06 -0400 |
commit | 3cd0d5bc284985703a3eb1c2eae3c14a28f7200b (patch) | |
tree | 8e782ccd35319576ec108dbcd755abbfba106c11 /widgets/msglist.go | |
parent | ec09ec8b0e70dabe216c2109e52fd21ef7fcae2b (diff) |
Fix segfault on :view-message for unloaded message
This also fixes segfault on :view-message on empty directory
Signed-off-by: Tom Lebreux <tomlebreux@cock.li>
Diffstat (limited to 'widgets/msglist.go')
-rw-r--r-- | widgets/msglist.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go index 1624e64..ea9b245 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -138,6 +138,10 @@ func (ml *MessageList) Store() *lib.MessageStore { return ml.store } +func (ml *MessageList) Empty() bool { + return ml.store == nil || len(ml.store.Uids) == 0 +} + func (ml *MessageList) Selected() *types.MessageInfo { return ml.store.Messages[ml.store.Uids[len(ml.store.Uids)-ml.selected-1]] } |