Browse Source

LibWeb: Null check `nearest_sibling` in `generate_missing_parents`

Caught by AddressSanitizer.
Aliaksandr Kalenik 2 năm trước cách đây
mục cha
commit
83b0613c68
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp

+ 5 - 1
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);
     }
 }