diff options
author | Linus Groh <mail@linusgroh.de> | 2020-05-18 00:56:44 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-18 09:39:55 +0200 |
commit | 56502b0e849a59b520f21e055879979adf78c238 (patch) | |
tree | 9101de63af39730cb0230542afd307b57aa8292a | |
parent | 4569e88bea5550b3cc82c31b8df906662fe77ae6 (diff) | |
download | serenity-56502b0e849a59b520f21e055879979adf78c238.zip |
LibJS: Check for exception after converting object to string primitive
-rw-r--r-- | Libraries/LibJS/Runtime/Value.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp index 37a5d9e3a7..1dc4746fd2 100644 --- a/Libraries/LibJS/Runtime/Value.cpp +++ b/Libraries/LibJS/Runtime/Value.cpp @@ -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); } |