diff options
author | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-07-15 18:57:44 +0000 |
---|---|---|
committer | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-07-15 18:57:44 +0000 |
commit | 2e4e5d61f21ce44386a96c83ad07444bf337ce21 (patch) | |
tree | dc13798549e5b19f1b0a03a8cb0231c3eda0fb54 /src/audio.c | |
parent | 62838fb8a4d27654998b6b304d1c485e497bfa4c (diff) |
Don't crash if audio can't be used
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@135 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/audio.c')
-rw-r--r-- | src/audio.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c index f42a13a..1303792 100644 --- a/src/audio.c +++ b/src/audio.c @@ -247,6 +247,8 @@ void audio_play(AudioContext *a, char *name, float volume, int repeat) { char filename[128]; struct stat statbuf; + if ( a == NULL ) return; + /* Try to find an Ogg/Vorbis file */ snprintf(filename, 127, "%s%s.ogg", DATADIR"/sound/", name); if ( stat(filename, &statbuf) == 0 ) { @@ -403,6 +405,8 @@ void audio_shutdown(AudioContext *a) { int i; + if ( a == NULL ) return; + SDL_CloseAudio(); /* Wait for dispatch threads */ |