From c22f8252b94b6c310c4cae30452e1975f3097d42 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 10 Aug 2019 13:33:31 -0400 Subject: [PATCH] Handle case where docRangeFromPoint returns null --- ext/mixed/js/display.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 3bb78fe1..8433c4b5 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -81,6 +81,9 @@ class Display { const clickedElement = $(e.target); const textSource = docRangeFromPoint({x: e.clientX, y: e.clientY}); + if (textSource === null) { + return false; + } textSource.setEndOffset(this.options.scanning.length); const {definitions, length} = await apiTermsFind(textSource.text());