瀏覽代碼

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.
MacDue 2 年之前
父節點
當前提交
88e50869f1
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibWeb/DOM/Node.cpp

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