diff --git a/nova_vm/src/ecmascript/builtins/structured_data/data_view_objects/data_view_constructor.rs b/nova_vm/src/ecmascript/builtins/structured_data/data_view_objects/data_view_constructor.rs index ea525569..fe6de430 100644 --- a/nova_vm/src/ecmascript/builtins/structured_data/data_view_objects/data_view_constructor.rs +++ b/nova_vm/src/ecmascript/builtins/structured_data/data_view_objects/data_view_constructor.rs @@ -135,9 +135,9 @@ impl DataViewConstructor { } // 14. If byteLength is not undefined, then - if !byte_length.is_undefined() { + if let Some(view_byte_length) = view_byte_length { // a. If offset + viewByteLength > bufferByteLength, throw a RangeError exception. - if offset + view_byte_length.unwrap() > buffer_byte_length { + if offset + view_byte_length > buffer_byte_length { return Err(agent.throw_exception_with_static_message( ExceptionType::RangeError, "offset is outside the bounds of the buffer",