aboutsummaryrefslogtreecommitdiffstats
path: root/code/client/snd_openal.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-02-26 18:47:39 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-02-26 18:47:39 +0000
commitf8bc3409cbd9a36f756086259f964be795b59b4c (patch)
tree2b9c8150cab178fcc8c13ce3a36129d4b8cdcd84 /code/client/snd_openal.c
parent3cbb3f928dda70718ed5f4158f4b2254078301d8 (diff)
downloadioquake3-aero-f8bc3409cbd9a36f756086259f964be795b59b4c.tar.gz
ioquake3-aero-f8bc3409cbd9a36f756086259f964be795b59b4c.zip
* Sound related bug fixes from Thilo Schulz
git-svn-id: svn://svn.icculus.org/quake3/trunk@587 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client/snd_openal.c')
-rw-r--r--code/client/snd_openal.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c
index 4fbb2ec..01b7fa2 100644
--- a/code/client/snd_openal.c
+++ b/code/client/snd_openal.c
@@ -1377,7 +1377,23 @@ void S_AL_StartBackgroundTrack( const char *intro, const char *loop )
// Queue the musicBuffers up
for(i = 0; i < NUM_MUSIC_BUFFERS; i++)
+ {
S_AL_MusicProcess(musicBuffers[i]);
+
+ // check whether our stream still exists.
+ if(!mus_stream)
+ {
+ // there was an error in reading which resulted in a
+ // closed stream. We must bail out or we'll crash.
+
+ // deallocate everything we allocated so far:
+ qalDeleteBuffers(NUM_MUSIC_BUFFERS, musicBuffers);
+ S_AL_MusicSourceFree();
+
+ return;
+ }
+ }
+
qalSourceQueueBuffers(musicSource, NUM_MUSIC_BUFFERS, musicBuffers);
// Set the initial gain property