mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibJS: Check for exception after converting object to string primitive
This commit is contained in:
parent
4569e88bea
commit
56502b0e84
Notes:
sideshowbarker
2024-07-19 06:32:14 +09:00
Author: https://github.com/linusg
Commit: 56502b0e84
Pull-request: https://github.com/SerenityOS/serenity/pull/2270
Issue: https://github.com/SerenityOS/serenity/issues/2267
1 changed files with 1 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue