From 354953a21db9a9d4a6661a599d3956d693428816 Mon Sep 17 00:00:00 2001
From: icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>
Date: Tue, 15 Sep 2009 06:19:04 +0000
Subject: Prevent hang in S_UpdateBackgroundTrack() with some sample rates.

  Fixes Bugzilla #4022.


git-svn-id: svn://svn.icculus.org/quake3/trunk@1622 edf5b092-35ff-0310-97b2-ce42778d08ea
---
 code/client/snd_dma.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'code/client')

diff --git a/code/client/snd_dma.c b/code/client/snd_dma.c
index a8ce121..cb8bfb9 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) ) {
-- 
cgit v1.2.3