From fc3a2933deee1fd8df29baec5b21bc4cb4759bc5 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Sat, 17 Feb 2024 17:24:56 +0100 Subject: [PATCH] Fix crash with animation audio track offset --- editor/animation_track_editor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 02bb1d219e8..cbfd233accb 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -5907,7 +5907,7 @@ void AnimationTrackEditor::_edit_menu_about_to_popup() { bool has_length = false; for (const KeyValue &E : selection) { - if (animation->track_get_type(E.key.track) == Animation::TYPE_AUDIO) { + if (animation->track_get_type(E.key.track) == Animation::TYPE_AUDIO && animation->audio_track_get_key_stream(E.key.track, E.key.key).is_valid()) { has_length = true; break; } @@ -6247,6 +6247,9 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { continue; } Ref stream = animation->audio_track_get_key_stream(E.key.track, E.key.key); + if (stream.is_null()) { + continue; + } double len = stream->get_length() - animation->audio_track_get_key_end_offset(E.key.track, E.key.key); real_t prev_offset = animation->audio_track_get_key_start_offset(E.key.track, E.key.key); double prev_time = animation->track_get_key_time(E.key.track, E.key.key); @@ -6273,6 +6276,9 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { continue; } Ref stream = animation->audio_track_get_key_stream(E.key.track, E.key.key); + if (stream.is_null()) { + continue; + } double len = stream->get_length() - animation->audio_track_get_key_start_offset(E.key.track, E.key.key); real_t prev_offset = animation->audio_track_get_key_end_offset(E.key.track, E.key.key); double prev_time = animation->track_get_key_time(E.key.track, E.key.key);