From 310effbb68b3e335574b682bb4359d8e29f3430b Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 26 Feb 2006 19:21:34 +0000 Subject: * Merged ioq3-r587 - Symlink following stuff - Sound fixes --- src/client/snd_openal.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/client/snd_openal.c') diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c index 699db246..fa1aaad0 100644 --- a/src/client/snd_openal.c +++ b/src/client/snd_openal.c @@ -1378,7 +1378,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 -- cgit