CDVD: Fix possible uncaught exception in CheckDiskTypeFS

This commit is contained in:
Connor McLaughlin 2021-10-01 15:48:04 +10:00 committed by refractionpcsx2
parent e0caacfa6f
commit 97b94acd86
1 changed files with 37 additions and 31 deletions

View File

@ -77,14 +77,16 @@ static void CheckNullCDVD()
static int CheckDiskTypeFS(int baseType)
{
IsoFSCDVD isofs;
try
{
IsoDirectory rootdir(isofs);
try
{
IsoFile file(rootdir, L"SYSTEM.CNF;1");
int size = file.getLength();
std::unique_ptr<char[]> buffer(new char[file.getLength() + 1]);
const int size = file.getLength();
const std::unique_ptr<char[]> buffer = std::make_unique<char[]>(size + 1);
file.read(buffer.get(), size);
buffer[size] = '\0';
@ -120,6 +122,10 @@ static int CheckDiskTypeFS(int baseType)
catch (Exception::FileNotFound&)
{
}
}
catch (Exception::FileNotFound&)
{
}
#ifdef PCSX2_DEVBUILD
return CDVD_TYPE_PS2DVD; // need this hack for some homebrew (SMS)