diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index d3f89c4c5e1..87784458f6b 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -606,7 +606,11 @@ void TreeBuilder::generate_missing_parents(NodeWithStyle& root) parent.remove_child(*table_box); wrapper->append_child(*table_box); - parent.insert_before(*wrapper, *nearest_sibling); + + if (nearest_sibling) + parent.insert_before(*wrapper, *nearest_sibling); + else + parent.append_child(*wrapper); } }