Przeglądaj źródła

LibJS: Fix null deref in ObjectProperty::dump()

davidot 3 lat temu
rodzic
commit
1fe6a422f1
1 zmienionych plików z 9 dodań i 2 usunięć
  1. 9 2
      Userland/Libraries/LibJS/AST.cpp

+ 9 - 2
Userland/Libraries/LibJS/AST.cpp

@@ -2272,8 +2272,15 @@ void VariableDeclarator::dump(int indent) const
 void ObjectProperty::dump(int indent) const
 {
     ASTNode::dump(indent);
-    m_key->dump(indent + 1);
-    m_value->dump(indent + 1);
+
+    if (m_property_type == Type::Spread) {
+        print_indent(indent + 1);
+        outln("...Spreading");
+        m_key->dump(indent + 1);
+    } else {
+        m_key->dump(indent + 1);
+        m_value->dump(indent + 1);
+    }
 }
 
 void ObjectExpression::dump(int indent) const