summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Value.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-12 21:36:19 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-13 01:14:22 +0200
commit063228c02ec0dd337cd412dad34baea93d3aca70 (patch)
tree6599ee2a191434ff69e60a15ac88c5bbbecaade2 /Libraries/LibJS/Runtime/Value.cpp
parentfbeaf76f9699fcb52b6a4b1fb1494a69601c13ed (diff)
downloadserenity-063228c02ec0dd337cd412dad34baea93d3aca70.zip
LibJS: Handle empty values in operator<<()
Otherwise something like dbg() << Value(); chokes on ASSERT_NOT_REACHED() in Value::to_string()
Diffstat (limited to 'Libraries/LibJS/Runtime/Value.cpp')
-rw-r--r--Libraries/LibJS/Runtime/Value.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp
index fbcab42581..2c94a253dd 100644
--- a/Libraries/LibJS/Runtime/Value.cpp
+++ b/Libraries/LibJS/Runtime/Value.cpp
@@ -370,7 +370,7 @@ Value instance_of(Interpreter&, Value lhs, Value rhs)
const LogStream& operator<<(const LogStream& stream, const Value& value)
{
- return stream << value.to_string();
+ return stream << (value.is_empty() ? "<empty>" : value.to_string());
}
bool same_value(Interpreter& interpreter, Value lhs, Value rhs)