diff options
author | Linus Groh <mail@linusgroh.de> | 2021-01-28 10:20:52 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-28 10:24:18 +0100 |
commit | 509e5a3045f2d165616d00d5c9b05863ba0883ef (patch) | |
tree | efd9dff3f56c5cdd4a9c219d64c48fc620afacb1 /Userland | |
parent | 803a20fa8676b07680d1e2ae224780ae28266588 (diff) | |
download | serenity-509e5a3045f2d165616d00d5c9b05863ba0883ef.zip |
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.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/AST.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 3e327ac365..29e9a8327b 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/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()) { |