aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Anders <greg@gpanders.com>2019-11-15 12:02:50 -0700
committerDrew DeVault <sir@cmpwn.com>2019-11-17 13:19:11 -0500
commit809083f8438401e2ee1d2d14712677f55eb4e4ef (patch)
treee5458880945990f6aac91984c990411948f8261a
parent8a848303fe0f19fde02793024299356bcdb06048 (diff)
Check for terminal before forwarding mouse event
When viewing a message part with no available filter, clicking the UI would cause a nil pointer dereference because the MouseEvent was passed to the PartViewer's `term` field, which does not exist in the case of an absent filter.
-rw-r--r--widgets/msgviewer.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 7cd5553..4d41923 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -336,7 +336,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
case tcell.Button1:
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)
}
for i, _ := range ps.parts {