summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAmir Yalon <mufHEsY6Za-20181118@yxejamir.net>2020-02-23 10:21:29 +0200
committerDrew DeVault <sir@cmpwn.com>2020-02-25 11:05:18 -0500
commit8ad517ea92356e97b35eb959ab3beef589fec686 (patch)
tree2e015e4c6731507dac97eb3662cb97ba00afbccb
parent1455ad97a9ec138fb7bcab4de8e45a8ad92ddd30 (diff)
downloadaerc-8ad517ea92356e97b35eb959ab3beef589fec686.tar.gz
Fix crash on mouse scrolling between message parts
-rw-r--r--widgets/msgviewer.go4
1 files 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 {