mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
LibJS: Return false for NaN numbers in Value::to_boolean()
This commit is contained in:
committed by
Andreas Kling
parent
4a9485f830
commit
57bd194e5a
@@ -83,6 +83,9 @@ bool Value::to_boolean() const
|
||||
case Type::Boolean:
|
||||
return m_value.as_bool;
|
||||
case Type::Number:
|
||||
if (is_nan()) {
|
||||
return false;
|
||||
}
|
||||
return !(m_value.as_double == 0 || m_value.as_double == -0);
|
||||
case Type::Null:
|
||||
case Type::Undefined:
|
||||
|
||||
Reference in New Issue
Block a user