comparison pytouhou/ui/music.pyx @ 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 a50c0a1b628f
comparison
equal deleted inserted replaced
528:7c3c90468996 529:bd0c15d28dd6
102 return 102 return
103 channel = self.get_channel(name) 103 channel = self.get_channel(name)
104 sound.play(channel, 0) 104 sound.play(channel, 0)
105 105
106 cpdef set_volume(self, name, float volume): 106 cpdef set_volume(self, name, float volume):
107 chunk = self.get_sound(name) 107 sound = self.get_sound(name)
108 chunk.set_volume(volume) 108 if sound is not None:
109 sound.set_volume(volume)