From 2c6be72f35f68513b0d511a37037018663cbc704 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Sat, 27 Feb 2021 13:46:29 +0800 Subject: [PATCH] close #491 check whether link node is head --- src/record/mutation.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/record/mutation.ts b/src/record/mutation.ts index bcdf7591..d80fb299 100644 --- a/src/record/mutation.ts +++ b/src/record/mutation.ts @@ -62,7 +62,11 @@ class DoubleLinkedList { if (current) { current.previous = node; } - } else if (n.nextSibling && isNodeInLinkedList(n.nextSibling)) { + } else if ( + n.nextSibling && + isNodeInLinkedList(n.nextSibling) && + n.nextSibling.__ln.previous + ) { const current = n.nextSibling.__ln.previous; node.previous = current; node.next = n.nextSibling.__ln;