[Audio] Prevent crash in interactive playback
This commit is contained in:
parent
0918fd2a21
commit
be652f160d
|
@ -976,6 +976,8 @@ void AudioStreamPlaybackInteractive::switch_to_clip_by_name(const StringName &p_
|
|||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_MSG(stream.is_null(), "Attempted to switch while not playing back any stream.");
|
||||
|
||||
for (int i = 0; i < stream->get_clip_count(); i++) {
|
||||
if (stream->get_clip_name(i) == p_name) {
|
||||
switch_request = i;
|
||||
|
|
|
@ -42,11 +42,11 @@
|
|||
void initialize_interactive_music_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
GDREGISTER_CLASS(AudioStreamPlaylist);
|
||||
GDREGISTER_VIRTUAL_CLASS(AudioStreamPlaybackPlaylist);
|
||||
GDREGISTER_ABSTRACT_CLASS(AudioStreamPlaybackPlaylist);
|
||||
GDREGISTER_CLASS(AudioStreamInteractive);
|
||||
GDREGISTER_VIRTUAL_CLASS(AudioStreamPlaybackInteractive);
|
||||
GDREGISTER_ABSTRACT_CLASS(AudioStreamPlaybackInteractive);
|
||||
GDREGISTER_CLASS(AudioStreamSynchronized);
|
||||
GDREGISTER_VIRTUAL_CLASS(AudioStreamPlaybackSynchronized);
|
||||
GDREGISTER_ABSTRACT_CLASS(AudioStreamPlaybackSynchronized);
|
||||
}
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||
|
|
Loading…
Reference in New Issue