Don't crash if SDL_AudioQuit() is called twice in a row.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 05 Jul 2013 00:54:00 -0400
changeset 7345 0021ad840cdd
parent 7344 3d9397262c10
child 7346 ff228f955a48
Don't crash if SDL_AudioQuit() is called twice in a row. Fixes Bugzilla #1396.
src/audio/SDL_audio.c
--- a/src/audio/SDL_audio.c	Fri Jul 05 00:41:34 2013 -0400
+++ b/src/audio/SDL_audio.c	Fri Jul 05 00:54:00 2013 -0400
@@ -1172,6 +1172,10 @@
 void
 SDL_AudioQuit(void)
 {
+    if (!current_audio.name) {  /* not initialized?! */
+        return;
+    }
+
     SDL_AudioDeviceID i;
     for (i = 0; i < SDL_arraysize(open_devices); i++) {
         if (open_devices[i] != NULL) {