summaryrefslogtreecommitdiff
path: root/src/client/snd_openal.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-02-26 19:21:34 +0000
committerTim Angus <tim@ngus.net>2006-02-26 19:21:34 +0000
commit310effbb68b3e335574b682bb4359d8e29f3430b (patch)
treea4760bd05975904f114a3fb47fff139ad623c049 /src/client/snd_openal.c
parenta59e1bf12d2fe0091eeb3ef3df8ce5a82baa1c8b (diff)
* Merged ioq3-r587
- Symlink following stuff - Sound fixes
Diffstat (limited to 'src/client/snd_openal.c')
-rw-r--r--src/client/snd_openal.c16
1 files changed, 16 insertions, 0 deletions
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