mirror of https://github.com/PCSX2/pcsx2.git
CDVD: Fix possible uncaught exception in CheckDiskTypeFS
This commit is contained in:
parent
e0caacfa6f
commit
97b94acd86
|
@ -77,14 +77,16 @@ static void CheckNullCDVD()
|
||||||
static int CheckDiskTypeFS(int baseType)
|
static int CheckDiskTypeFS(int baseType)
|
||||||
{
|
{
|
||||||
IsoFSCDVD isofs;
|
IsoFSCDVD isofs;
|
||||||
|
try
|
||||||
|
{
|
||||||
IsoDirectory rootdir(isofs);
|
IsoDirectory rootdir(isofs);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IsoFile file(rootdir, L"SYSTEM.CNF;1");
|
IsoFile file(rootdir, L"SYSTEM.CNF;1");
|
||||||
|
|
||||||
int size = file.getLength();
|
const int size = file.getLength();
|
||||||
|
const std::unique_ptr<char[]> buffer = std::make_unique<char[]>(size + 1);
|
||||||
std::unique_ptr<char[]> buffer(new char[file.getLength() + 1]);
|
|
||||||
file.read(buffer.get(), size);
|
file.read(buffer.get(), size);
|
||||||
buffer[size] = '\0';
|
buffer[size] = '\0';
|
||||||
|
|
||||||
|
@ -120,6 +122,10 @@ static int CheckDiskTypeFS(int baseType)
|
||||||
catch (Exception::FileNotFound&)
|
catch (Exception::FileNotFound&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception::FileNotFound&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
return CDVD_TYPE_PS2DVD; // need this hack for some homebrew (SMS)
|
return CDVD_TYPE_PS2DVD; // need this hack for some homebrew (SMS)
|
||||||
|
|
Loading…
Reference in New Issue