From 3c8f0cd89b8296f242773def2f729299020310fb Mon Sep 17 00:00:00 2001 From: Neil Jenkins Date: Tue, 23 Jul 2024 14:16:36 +1000 Subject: [PATCH] Fix crash extracting contents of range endContainer can be null here. --- source/range/InsertDelete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/range/InsertDelete.ts b/source/range/InsertDelete.ts index c443bf9..f6f34d4 100644 --- a/source/range/InsertDelete.ts +++ b/source/range/InsertDelete.ts @@ -134,7 +134,7 @@ const extractContentsOfRange = ( } // Merge text nodes if adjacent - node = endContainer.previousSibling; + node = endContainer && endContainer.previousSibling; if (node && node instanceof Text && endContainer instanceof Text) { endOffset = node.length; node.appendData(endContainer.data);