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`.
This commit is contained in:
Wiktor Kwapisiewicz 2020-02-22 17:05:46 +01:00 committed by Drew DeVault
parent cb04629f3c
commit 1455ad97a9

View file

@ -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()
}
}