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.
This commit is contained in:
parent
8a848303fe
commit
809083f843
|
@ -336,7 +336,7 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
|
||||||
case tcell.Button1:
|
case tcell.Button1:
|
||||||
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)
|
||||||
}
|
}
|
||||||
for i, _ := range ps.parts {
|
for i, _ := range ps.parts {
|
||||||
|
|
Loading…
Reference in New Issue