1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 09:05:09 +00:00

LibJS: Oops, non-zero values should boolify to true, not false

This commit is contained in:
Andreas Kling 2020-03-10 10:03:50 +01:00
parent e9687ee50e
commit a0e18f4450

View file

@ -59,7 +59,7 @@ bool Value::to_boolean() const
case Type::Boolean:
return m_value.as_bool;
case Type::Number:
return m_value.as_double == 0 || m_value.as_double == -0;
return !(m_value.as_double == 0 || m_value.as_double == -0);
case Type::Null:
case Type::Undefined:
return false;