diff --git a/src/d8.cc b/src/d8.cc index 9390c846d6..544e824870 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -300,11 +300,11 @@ Handle Shell::CreateExternalArray(const Arguments& args, if (number.IsEmpty() || !number->IsNumber()) { return ThrowException(String::New("Array length must be a number.")); } - double raw_length = number->NumberValue(); + int32_t raw_length = number->ToInt32()->Int32Value(); if (raw_length < 0) { return ThrowException(String::New("Array length must not be negative.")); } - if (raw_length > kMaxLength) { + if (raw_length > static_cast(kMaxLength)) { return ThrowException( String::New("Array length exceeds maximum length.")); }