1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:37:35 +00:00

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.
This commit is contained in:
Linus Groh 2021-01-28 10:20:52 +01:00 committed by Andreas Kling
parent 803a20fa86
commit 509e5a3045

View file

@ -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()) {