From 69883bea6f0b447b3abfd63bc7289ced87526675 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 7 Nov 2019 22:42:55 +0100 Subject: LibHTML: Update the removed node's siblings in TreeNode::remove_child() Oops, we forgot to update the node's siblings' sibling pointers when removing a node from the tree. Thanks to Owlinated for pointing this out! :^) --- Libraries/LibHTML/TreeNode.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Libraries/LibHTML/TreeNode.h b/Libraries/LibHTML/TreeNode.h index ae84db165b..4459e4cfc0 100644 --- a/Libraries/LibHTML/TreeNode.h +++ b/Libraries/LibHTML/TreeNode.h @@ -121,6 +121,12 @@ inline NonnullRefPtr TreeNode::remove_child(NonnullRefPtr node, bool ca if (m_last_child == node) m_last_child = node->m_previous_sibling; + if (node->m_next_sibling) + node->m_next_sibling->m_previous_sibling = node->m_previous_sibling; + + if (node->m_previous_sibling) + node->m_previous_sibling->m_next_sibling = node->m_next_sibling; + node->m_next_sibling = nullptr; node->m_previous_sibling = nullptr; node->m_parent = nullptr; -- cgit v1.2.3