# HG changeset patch # User David Fraser # Date 1252391714 0 # Node ID e23637457aa495ca4f4a6ef0d066d7096a1c249e # Parent d1ff514fb6d49c67eaed6eee71a760a2945bbf9c Prevent error stopping music when sound not initialized diff -r d1ff514fb6d4 -r e23637457aa4 gamelib/sound.py --- 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()