changeset 529:bd0c15d28dd6

Always verify chunks are not None before using them, fix crash when audio is disabled.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 23 Mar 2014 10:51:19 +0100
parents 7c3c90468996
children 64d9117b9209
files pytouhou/ui/music.pyx
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/ui/music.pyx
+++ b/pytouhou/ui/music.pyx
@@ -104,5 +104,6 @@ cdef class SFXPlayer(MusicPlayer):
         sound.play(channel, 0)
 
     cpdef set_volume(self, name, float volume):
-        chunk = self.get_sound(name)
-        chunk.set_volume(volume)
+        sound = self.get_sound(name)
+        if sound is not None:
+            sound.set_volume(volume)