From 8ad517ea92356e97b35eb959ab3beef589fec686 Mon Sep 17 00:00:00 2001 From: Amir Yalon Date: Sun, 23 Feb 2020 10:21:29 +0200 Subject: [PATCH] Fix crash on mouse scrolling between message parts --- widgets/msgviewer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 93d3d89..19a2380 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -373,7 +373,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) { case tcell.WheelDown: height := len(ps.parts) 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) } 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: height := len(ps.parts) 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) } if ps.parts[ps.selected].term != nil {