Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index a5b46a454a15b948d9cc649a125243d6cf1604aa..33d493ec2c67bc6dff7ea84566a4feea6db4f631 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -4171,7 +4171,8 @@ typename Traits::ElementType FixedTypedArray<Traits>::from_double( |
template<> inline |
uint8_t FixedTypedArray<Uint8ClampedArrayTraits>::from_double(double value) { |
- if (value < 0) return 0; |
+ // Handle NaNs and less than zero values which clamp to zero. |
+ if (!(value > 0)) return 0; |
if (value > 0xFF) return 0xFF; |
return static_cast<uint8_t>(lrint(value)); |
} |