From b9f033d1fa2a5f339654c48bcb22201d72a3de44 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 15 Sep 2009 06:19:04 +0000 Subject: [PATCH] Prevent hang in S_UpdateBackgroundTrack() with some sample rates. Fixes Bugzilla #4022. --- code/client/snd_dma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/client/snd_dma.c b/code/client/snd_dma.c index a8ce1212..cb8bfb94 100644 --- a/code/client/snd_dma.c +++ b/code/client/snd_dma.c @@ -1374,6 +1374,9 @@ void S_UpdateBackgroundTrack( void ) { // decide how much data needs to be read from the file fileSamples = bufferSamples * s_backgroundStream->info.rate / dma.speed; + if (!fileSamples) + return; + // our max buffer size fileBytes = fileSamples * (s_backgroundStream->info.width * s_backgroundStream->info.channels); if ( fileBytes > sizeof(raw) ) {