mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: Prevent null deref in the "restore the values of nodes" algo
This commit is contained in:
parent
c90c5aad29
commit
a3b3f2f30d
Notes:
github-actions[bot]
2024-12-21 18:17:29 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/a3b3f2f30d0 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2991
1 changed files with 3 additions and 3 deletions
|
@ -2294,12 +2294,12 @@ void restore_the_values_of_nodes(Vector<RecordedNodeValue> const& values)
|
|||
|
||||
// 2. If ancestor is not an Element, set it to its parent.
|
||||
if (!is<DOM::Element>(*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<DOM::Element>(*ancestor) && !specified_command_value(static_cast<DOM::Element&>(*ancestor), command).has_value())
|
||||
ancestor = *ancestor->parent();
|
||||
while (is<DOM::Element>(ancestor.ptr()) && !specified_command_value(static_cast<DOM::Element&>(*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.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue