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) ml.aerc.NewTab(viewer, msg.Envelope.Subject)
} }
case tcell.WheelDown: case tcell.WheelDown:
if ml.store != nil {
ml.store.Next() ml.store.Next()
}
ml.Scroll() ml.Scroll()
case tcell.WheelUp: case tcell.WheelUp:
if ml.store != nil {
ml.store.Prev() ml.store.Prev()
}
ml.Scroll() ml.Scroll()
} }
} }