LibJS: Handle empty values in operator<<()

Otherwise something like dbg() << Value(); chokes on
ASSERT_NOT_REACHED() in Value::to_string()
This commit is contained in:
Linus Groh 2020-05-12 21:36:19 +01:00 committed by Andreas Kling
parent fbeaf76f96
commit 063228c02e
Notes: sideshowbarker 2024-07-19 06:41:30 +09:00

View file

@ -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)