From 88e50869f1360e3d78bfbd99a39a4c313cac9e3f Mon Sep 17 00:00:00 2001 From: MacDue Date: Sun, 18 Dec 2022 01:18:19 +0000 Subject: [PATCH] LibWeb: Fix crash when serializing nodes for DOM inspector Noticed this trying to inspect GitHub, you'd get a segfault due to the parent node being null here. --- Userland/Libraries/LibWeb/DOM/Node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index d213cb4385..735ab0e1f2 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -1015,7 +1015,7 @@ bool Node::is_uninteresting_whitespace_node() const return false; if (!layout_node()) return true; - if (layout_node()->parent()->is_anonymous()) + if (auto parent = layout_node()->parent(); parent && parent->is_anonymous()) return true; return false; }