aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/document.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/document.js')
-rw-r--r--ext/fg/js/document.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index 9366832e..13acb036 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -85,14 +85,24 @@ function docRangeFromPoint(point) {
range.setEnd(position.offsetNode, position.offset);
return range;
}
+ return null;
};
}
const range = document.caretRangeFromPoint(point.x, point.y);
+ if (range === null) {
+ return;
+ }
if(imposter !== null) imposter.style.zIndex = -2147483646;
- const rect = range.getClientRects()[0];
+ const rects = range.getClientRects();
+
+ if (rects.length === 0) {
+ return;
+ }
+
+ const rect = rects[0];
if (point.y > rect.bottom + 2) {
return;
}