summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Runtime/Array.cpp')
-rw-r--r--Libraries/LibJS/Runtime/Array.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Libraries/LibJS/Runtime/Array.cpp b/Libraries/LibJS/Runtime/Array.cpp
index 2b1d0eae59..b9c6749043 100644
--- a/Libraries/LibJS/Runtime/Array.cpp
+++ b/Libraries/LibJS/Runtime/Array.cpp
@@ -74,7 +74,9 @@ void Array::length_setter(Interpreter& interpreter, Value value)
auto* array = array_from(interpreter);
if (!array)
return;
- auto length = value.to_number();
+ auto length = value.to_number(interpreter);
+ if (interpreter.exception())
+ return;
if (length.is_nan() || length.is_infinity() || length.as_double() < 0) {
interpreter.throw_exception<RangeError>("Invalid array length");
return;