Fix crash on mouse scrolling between message parts

This commit is contained in:
Amir Yalon 2020-02-23 10:21:29 +02:00 committed by Drew DeVault
parent 1455ad97a9
commit 8ad517ea92

View file

@ -373,7 +373,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
case tcell.WheelDown: case tcell.WheelDown:
height := len(ps.parts) height := len(ps.parts)
y := ps.height - height y := ps.height - height
if localY < y { if localY < y && ps.parts[ps.selected].term != nil {
ps.parts[ps.selected].term.MouseEvent(localX, localY, event) ps.parts[ps.selected].term.MouseEvent(localX, localY, event)
} }
if ps.parts[ps.selected].term != nil { if ps.parts[ps.selected].term != nil {
@ -386,7 +386,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
case tcell.WheelUp: case tcell.WheelUp:
height := len(ps.parts) height := len(ps.parts)
y := ps.height - height y := ps.height - height
if localY < y { if localY < y && ps.parts[ps.selected].term != nil {
ps.parts[ps.selected].term.MouseEvent(localX, localY, event) ps.parts[ps.selected].term.MouseEvent(localX, localY, event)
} }
if ps.parts[ps.selected].term != nil { if ps.parts[ps.selected].term != nil {