mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Check parent node exists before checking its type
This commit is contained in:
parent
8002efe780
commit
d1678e03ff
Notes:
github-actions[bot]
2025-07-15 06:39:00 +00:00
Author: https://github.com/tcl3
Commit: d1678e03ff
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5448
Reviewed-by: https://github.com/shannonbooth ✅
2 changed files with 8 additions and 1 deletions
|
@ -232,7 +232,7 @@ void XMLDocumentBuilder::element_end(const XML::Name& name)
|
||||||
};
|
};
|
||||||
|
|
||||||
auto* parent = m_current_node->parent_node();
|
auto* parent = m_current_node->parent_node();
|
||||||
if (parent->is_document_fragment()) {
|
if (parent && parent->is_document_fragment()) {
|
||||||
auto template_parent_node = m_template_node_stack.take_last();
|
auto template_parent_node = m_template_node_stack.take_last();
|
||||||
parent = template_parent_node.ptr();
|
parent = template_parent_node.ptr();
|
||||||
}
|
}
|
||||||
|
|
7
Tests/LibWeb/Crash/DOM/xhtml-namespace-change.xhtml
Normal file
7
Tests/LibWeb/Crash/DOM/xhtml-namespace-change.xhtml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head><script>
|
||||||
|
var newRoot = document.createElementNS("http://www.w3.org/2000/svg", "test");
|
||||||
|
document.removeChild(document.documentElement);
|
||||||
|
document.appendChild(newRoot);
|
||||||
|
</script></head>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue