From 02927f9004132114c975b34491ceb28fb764f2f8 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 18 Sep 2019 22:11:18 -0400 Subject: [PATCH] Handle null return value of document.caretPositionFromPoint --- ext/fg/js/document.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js index 9afc44f0..94a68e6c 100644 --- a/ext/fg/js/document.js +++ b/ext/fg/js/document.js @@ -267,6 +267,9 @@ const caretRangeFromPoint = (() => { // Firefox return (x, y) => { const position = document.caretPositionFromPoint(x, y); + if (position === null) { + return null; + } const node = position.offsetNode; if (node === null) { return null;