diff --git a/Source/Core/Core/IOS/Device.cpp b/Source/Core/Core/IOS/Device.cpp index b3324503f0..9d04dca6ba 100644 --- a/Source/Core/Core/IOS/Device.cpp +++ b/Source/Core/Core/IOS/Device.cpp @@ -78,7 +78,8 @@ IOCtlVRequest::IOCtlVRequest(const u32 address_) : Request(address_) const IOCtlVRequest::IOVector* IOCtlVRequest::GetVector(size_t index) const { - ASSERT(index < (in_vectors.size() + io_vectors.size())); + if (index >= in_vectors.size() + io_vectors.size()) + return nullptr; if (index < in_vectors.size()) return &in_vectors[index]; return &io_vectors[index - in_vectors.size()]; diff --git a/Source/Core/Core/IOS/Device.h b/Source/Core/Core/IOS/Device.h index bffe1cdc1c..b3944eb16e 100644 --- a/Source/Core/Core/IOS/Device.h +++ b/Source/Core/Core/IOS/Device.h @@ -154,7 +154,10 @@ struct IOCtlVRequest final : Request // merging them into a single std::vector would make using the first out vector more complicated. std::vector in_vectors; std::vector io_vectors; + + /// Returns the specified vector or nullptr if the index is out of bounds. const IOVector* GetVector(size_t index) const; + explicit IOCtlVRequest(u32 address); bool HasNumberOfValidVectors(size_t in_count, size_t io_count) const; void Dump(std::string_view description, Common::Log::LOG_TYPE type = Common::Log::IOS,