Bläddra i källkod

LibJS: Fix crash when printing error for missing class extends value prototype

If it's missing we get an empty value, but we can't use that with
to_string_without_side_effects() so we have to use undefined as the
default.

Fixes #5142.
Linus Groh 4 år sedan
förälder
incheckning
509e5a3045
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      Userland/Libraries/LibJS/AST.cpp

+ 1 - 1
Userland/Libraries/LibJS/AST.cpp

@@ -818,7 +818,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
 
         Object* super_constructor_prototype = nullptr;
         if (!super_constructor.is_null()) {
-            auto super_constructor_prototype_value = super_constructor.as_object().get(vm.names.prototype);
+            auto super_constructor_prototype_value = super_constructor.as_object().get(vm.names.prototype).value_or(js_undefined());
             if (interpreter.exception())
                 return {};
             if (!super_constructor_prototype_value.is_object() && !super_constructor_prototype_value.is_null()) {