CDVD: safety fixes on hard swaps

This commit is contained in:
GovanifY 2020-09-06 17:59:18 +02:00 committed by refractionpcsx2
parent f9be4286bd
commit 4b1467ea69
1 changed files with 14 additions and 3 deletions

View File

@ -312,9 +312,18 @@ s32 CALLBACK DISCgetTD(u8 Track, cdvdTD* Buffer)
{
if (Track == 0)
{
Buffer->lsn = src->GetSectorCount();
Buffer->type = 0;
return 0;
if (src == nullptr)
return -1;
try
{
Buffer->lsn = src->GetSectorCount();
Buffer->type = 0;
return 0;
}
catch (...)
{
return -1;
}
}
if (Track < strack)
@ -495,6 +504,8 @@ s32 CALLBACK DISCreadSector(u8* buffer, u32 lsn, int mode)
s32 CALLBACK DISCgetDualInfo(s32* dualType, u32* _layer1start)
{
if (src == nullptr)
return -1;
switch (src->GetMediaType())
{
case 1: