Prevent mouse interaction crashing app

Possibly helps everyone in #63, #73 and #94

Whether it solves the issue or not, this definitely fixes a bug.
`CurrentTab` doesn't refer to anything until the first frame is received
from the webextension, yet tthe `handleMouseEvent` function can be
triggered long before that.
This commit is contained in:
Thomas Buckley-Houston 2018-07-11 11:26:57 +08:00
parent 7e21f89ca9
commit 3ee9b16ea8

View file

@ -147,6 +147,7 @@ func handleScrolling(ev *tcell.EventKey) {
}
func handleMouseEvent(ev *tcell.EventMouse) {
if CurrentTab == nil { return }
x, y := ev.Position()
xInFrame := x + CurrentTab.frame.xScroll
yInFrame := y - uiHeight + CurrentTab.frame.yScroll