aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWiktor Kwapisiewicz <wiktor@metacode.biz>2020-02-22 17:05:46 +0100
committerDrew DeVault <sir@cmpwn.com>2020-02-22 11:06:15 -0500
commit1455ad97a9ec138fb7bcab4de8e45a8ad92ddd30 (patch)
treeca71e599eb747f379d4d82791220cd23b85be44d
parentcb04629f3c2682494f32261c2a99200e2126f7a5 (diff)
downloadaerc-1455ad97a9ec138fb7bcab4de8e45a8ad92ddd30.tar.gz
Fix crash on mouse scrolling before messages load
Using mouse scroll before messages load will trigger a panic as `ml.store` has not been assigned yet and is `nil`.
-rw-r--r--widgets/msglist.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 9aff0d45..51c133c0 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -163,10 +163,14 @@ func (ml *MessageList) MouseEvent(localX int, localY int, event tcell.Event) {
ml.aerc.NewTab(viewer, msg.Envelope.Subject)
}
case tcell.WheelDown:
- ml.store.Next()
+ if ml.store != nil {
+ ml.store.Next()
+ }
ml.Scroll()
case tcell.WheelUp:
- ml.store.Prev()
+ if ml.store != nil {
+ ml.store.Prev()
+ }
ml.Scroll()
}
}