Skip to content

Commit

Permalink
fix: Use an if let instead
Browse files Browse the repository at this point in the history
  • Loading branch information
eliassjogreen committed Oct 19, 2024
1 parent 15de646 commit 9750404
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9750404

Please sign in to comment.