From a3b3f2f30d0b2c949088dd07a200078d32d704a5 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Thu, 19 Dec 2024 12:58:07 +0100 Subject: [PATCH] LibWeb: Prevent null deref in the "restore the values of nodes" algo --- Libraries/LibWeb/Editing/Internal/Algorithms.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp index f9bf6b3ea6b..f72081531fc 100644 --- a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp +++ b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp @@ -2294,12 +2294,12 @@ void restore_the_values_of_nodes(Vector const& values) // 2. If ancestor is not an Element, set it to its parent. if (!is(*ancestor)) - ancestor = *ancestor->parent(); + ancestor = ancestor->parent(); // 3. While ancestor is an Element and its specified command value for command is null, set it to its parent. auto const& command = recorded_node_value.command; - while (is(*ancestor) && !specified_command_value(static_cast(*ancestor), command).has_value()) - ancestor = *ancestor->parent(); + while (is(ancestor.ptr()) && !specified_command_value(static_cast(*ancestor), command).has_value()) + ancestor = ancestor->parent(); // FIXME: 4. If value is null and ancestor is an Element, push down values on node for command, with new value null.