CDImage: Fix crash on invalid cue/chd with no tracks

This commit is contained in:
Connor McLaughlin 2020-10-15 18:08:18 +10:00
parent 95f7821691
commit 893268bba5
2 changed files with 12 additions and 0 deletions

View File

@ -238,6 +238,12 @@ bool CDImageCHD::Open(const char* filename)
file_lba = Common::AlignUp(file_lba, CHD_CD_TRACK_ALIGNMENT);
}
if (m_tracks.empty())
{
Log_ErrorPrintf("File '%s' contains no tracks", filename);
return false;
}
m_lba_count = disc_lba;
AddLeadOutIndex();

View File

@ -217,6 +217,12 @@ bool CDImageCueSheet::OpenAndParse(const char* filename)
}
}
if (m_tracks.empty())
{
Log_ErrorPrintf("File '%s' contains no tracks", filename);
return false;
}
m_lba_count = disc_lba;
AddLeadOutIndex();