Browse Source

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

Andreas Kling 5 years ago
parent
commit
a0e18f4450
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Libraries/LibJS/Value.cpp

+ 1 - 1
Libraries/LibJS/Value.cpp

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