LibJS: Check for exception after converting object to string primitive

This commit is contained in:
Linus Groh 2020-05-18 00:56:44 +01:00 committed by Andreas Kling
parent 4569e88bea
commit 56502b0e84
Notes: sideshowbarker 2024-07-19 06:32:14 +09:00

View file

@ -136,8 +136,7 @@ String Value::to_string(Interpreter& interpreter) const
if (is_object()) {
auto primitive_value = as_object().to_primitive(Object::PreferredType::String);
// FIXME: Maybe we should pass in the Interpreter& and call interpreter.exception() instead?
if (primitive_value.is_empty())
if (interpreter.exception())
return {};
return primitive_value.to_string(interpreter);
}