diff --git a/source/ps/Filesystem.cpp b/source/ps/Filesystem.cpp index 6b96315942..acd83441e1 100644 --- a/source/ps/Filesystem.cpp +++ b/source/ps/Filesystem.cpp @@ -96,6 +96,7 @@ Status ReloadChangedFiles() CVFSFile::CVFSFile() + : m_BufferSize(0) { } @@ -116,6 +117,8 @@ PSRETURN CVFSFile::Load(const PIVFS& vfs, const VfsPath& filename) if (ret != INFO::OK) { LOGERROR(L"CVFSFile: file %ls couldn't be opened (vfs_load: %lld)", filename.string().c_str(), (long long)ret); + m_Buffer.reset(); + m_BufferSize = 0; return PSRETURN_CVFSFile_LoadFailed; } @@ -124,14 +127,6 @@ PSRETURN CVFSFile::Load(const PIVFS& vfs, const VfsPath& filename) const u8* CVFSFile::GetBuffer() const { - // Die in a very obvious way, to avoid subtle problems caused by - // accidentally forgetting to check that the open succeeded - if (!m_Buffer) - { - debug_warn(L"GetBuffer() called with no file loaded"); - throw PSERROR_CVFSFile_InvalidBufferAccess(); - } - return m_Buffer.get(); } diff --git a/source/ps/Filesystem.h b/source/ps/Filesystem.h index 38c91018e2..fbf7180c8a 100644 --- a/source/ps/Filesystem.h +++ b/source/ps/Filesystem.h @@ -57,7 +57,6 @@ extern Status ReloadChangedFiles(); ERROR_GROUP(CVFSFile); ERROR_TYPE(CVFSFile, LoadFailed); ERROR_TYPE(CVFSFile, AlreadyLoaded); -ERROR_TYPE(CVFSFile, InvalidBufferAccess); // Reads a file, then gives read-only access to the contents class CVFSFile