fixed music playback crash in CPMA credits with s_musicvolume > 0

This commit is contained in:
myT 2022-04-08 21:41:26 +02:00
parent 7923a0a94e
commit 9b114e7886
1 changed files with 5 additions and 0 deletions

View File

@ -1037,6 +1037,11 @@ static void S_UpdateBackgroundTrack()
// decide how much data needs to be read from the file
fileSamples = bufferSamples * s_backgroundStream->info.rate / dma.speed;
// fileSamples can become 0 when dma.speed > s_backgroundStream->info.rate
if ( fileSamples <= 0 ) {
break;
}
// our max buffer size
fileBytes = fileSamples * (s_backgroundStream->info.width * s_backgroundStream->info.channels);
if ( fileBytes > sizeof(raw) ) {