diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp index 90d543acc6..24b2491113 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp @@ -313,9 +313,11 @@ void TypedArrayBase::visit_edges(Visitor& visitor) \ auto array_length = first_argument.to_index(global_object()); \ if (vm.exception()) { \ - /* Re-throw more specific RangeError */ \ - vm.clear_exception(); \ - vm.throw_exception(global_object(), ErrorType::InvalidLength, "typed array"); \ + if (vm.exception()->value().is_object() && is(vm.exception()->value().as_object())) { \ + /* Re-throw more specific RangeError */ \ + vm.clear_exception(); \ + vm.throw_exception(global_object(), ErrorType::InvalidLength, "typed array"); \ + } \ return {}; \ } \ if (array_length > NumericLimits::max() / sizeof(Type)) { \