diff --git a/korman/nodes/node_messages.py b/korman/nodes/node_messages.py index 94db51b..af1b5e1 100644 --- a/korman/nodes/node_messages.py +++ b/korman/nodes/node_messages.py @@ -839,7 +839,10 @@ class PlasmaSoundMsgNode(idprops.IDPropObjectMixin, PlasmaMessageWithCallbacksNo # Remember that 3D stereo sounds are exported as two emitters... # But, if we only have one sound attached, who cares, we can just address the message to all msg = plSoundMsg() - sound_keys = tuple(soundemit.get_sound_keys(exporter, self.sound_name)) + try: + sound_keys = tuple(soundemit.get_sound_keys(exporter, self.sound_name)) + except ValueError as ex: + self.raise_error(f"Invalid sound specified {ex}") indices = frozenset((i[1] for i in sound_keys)) if indices: diff --git a/korman/properties/modifiers/sound.py b/korman/properties/modifiers/sound.py index 477427e..7d0adca 100644 --- a/korman/properties/modifiers/sound.py +++ b/korman/properties/modifiers/sound.py @@ -691,8 +691,10 @@ class PlasmaSoundEmitter(PlasmaModifierProperties): lfm_key.object.addStereizer(stereizer.key) def get_sound_keys(self, exporter, name=None, sound=None) -> Iterator[Tuple[plKey, int]]: - assert name or sound + assert name is not None or sound is not None if sound is None: + if not name: + raise ValueError(f"{self.id_data.name}: (No sound specified)") sound = next((i for i in self.sounds if i.name == name), None) if sound is None: raise ValueError(f"{self.id_data.name}: Sound {name}")