From 9b114e7886f4dcd048fa3fbc5434c2c2706a03fd Mon Sep 17 00:00:00 2001 From: myT Date: Fri, 8 Apr 2022 21:41:26 +0200 Subject: [PATCH] fixed music playback crash in CPMA credits with s_musicvolume > 0 --- code/client/snd_dma.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/client/snd_dma.cpp b/code/client/snd_dma.cpp index cb73946..098f66d 100644 --- a/code/client/snd_dma.cpp +++ b/code/client/snd_dma.cpp @@ -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) ) {