Skip to content

Commit

Permalink
Prevent mouse interaction crashing app
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tombh committed Jul 11, 2018
1 parent 7e21f89 commit 3ee9b16
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions interfacer/src/browsh/tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3ee9b16

Please sign in to comment.