From 2d130ffad4a98f9dc07555cc5709970bd83cf8ca Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 11 Dec 2024 11:23:37 +0100 Subject: [PATCH] LibWeb: Make new_container in insertParagraph command a GC::Ref This value will never be null. --- Libraries/LibWeb/Editing/Commands.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibWeb/Editing/Commands.cpp b/Libraries/LibWeb/Editing/Commands.cpp index 860f7b5f241..bd0a415b06c 100644 --- a/Libraries/LibWeb/Editing/Commands.cpp +++ b/Libraries/LibWeb/Editing/Commands.cpp @@ -697,7 +697,7 @@ bool command_insert_paragraph_action(DOM::Document& document, String const&) }(); // 22. Let new container be the result of calling createElement(new container name) on the context object. - GC::Ptr new_container = MUST(DOM::create_element(document, new_container_name, Namespace::HTML)); + auto new_container = MUST(DOM::create_element(document, new_container_name, Namespace::HTML)); // 23. Copy all attributes of container to new container. container_element.for_each_attribute([&new_container](FlyString const& name, String const& value) { @@ -742,7 +742,7 @@ bool command_insert_paragraph_action(DOM::Document& document, String const&) // 31. While new container's lastChild is a prohibited paragraph child, set new container to its lastChild. while (new_container->last_child() && is_prohibited_paragraph_child(*new_container->last_child())) { // NOTE: is_prohibited_paragraph_child() ensures that last_child() is an HTML::HTMLElement - new_container = static_cast(new_container->last_child()); + new_container = static_cast(*new_container->last_child()); } // 32. If container has no visible children, call createElement("br") on the context object, and append the result