changeset 363:e23637457aa4

Prevent error stopping music when sound not initialized
author David Fraser <davidf@sjsoft.com>
date Tue, 08 Sep 2009 06:35:14 +0000
parents d1ff514fb6d4
children 2655a99aa509
files gamelib/sound.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/sound.py	Mon Sep 07 15:31:22 2009 +0000
+++ b/gamelib/sound.py	Tue Sep 08 06:35:14 2009 +0000
@@ -35,6 +35,8 @@
 def stop_background_music():
     """stops any playing background music"""
     global CURRENT_MUSIC_FILE
+    if not SOUND_INITIALIZED:
+        return
     CURRENT_MUSIC_FILE = None
     # TODO: fadeout in a background thread
     pygame.mixer.music.stop()