Catch exceptions thrown by range.getClientRects()

Firefox dev 65 was throwing an exception
This commit is contained in:
toasted-nutbread 2018-12-10 17:09:06 -05:00
parent 39cf302eef
commit 33ec369eff

View File

@ -92,7 +92,19 @@ function docRangeFromPoint(point) {
if(imposter !== null) imposter.style.zIndex = -2147483646; if(imposter !== null) imposter.style.zIndex = -2147483646;
const rect = range.getClientRects()[0]; let rects;
try {
rects = range.getClientRects();
}
catch (e) {
return;
}
if (rects.length === 0) {
return;
}
const rect = rects[0];
if (point.y > rect.bottom + 2) { if (point.y > rect.bottom + 2) {
return; return;
} }