CDAudio: don't crash when read requested past end of disc

This commit is contained in:
beirich 2011-09-04 19:55:41 +00:00
parent d7c267cbbe
commit e61ea6050a
1 changed files with 4 additions and 1 deletions

View File

@ -124,7 +124,10 @@ namespace BizHawk.Emulation.Sound
{
if (CachedSector != CurrentSector)
{
Disc.ReadLBA_2352(CurrentSector, SectorCache, 0);
if (CurrentSector >= Disc.LBACount)
Array.Clear(SectorCache, 0, 2352); // request reading past end of available disc
else
Disc.ReadLBA_2352(CurrentSector, SectorCache, 0);
CachedSector = CurrentSector;
}
}