Handle no sounds found

This commit is contained in:
Jamie Hardt
2020-09-19 22:57:25 -07:00
parent 17bc2744ce
commit 723b20a5b6
2 changed files with 11 additions and 8 deletions

View File

@@ -16,6 +16,9 @@ class SoundBank:
return [sound for sound in bpy.data.sounds if sound.name.startswith(self.prefix)]
def random_sound(self) -> Sound:
if len(self.sounds()) == 0:
return None
else:
return choice(self.sounds())
def get_audiofile_info(self, sound, fps) -> (int, int):