summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorBrinerLovo <9621064+BrinerLovo@users.noreply.github.com>2023-09-20 17:01:00 -0400
committerRémi Verschelde <rverschelde@gmail.com>2024-07-08 23:18:03 +0200
commitbf01119cdf803e8d8b4b6cad969f858c710dda39 (patch)
tree22f7f9278e20bc0e73a700136a7470091203f393 /editor
parent16f98cd7079c2b22248ec358371f17bca355e42e (diff)
downloadredot-engine-bf01119cdf803e8d8b4b6cad969f858c710dda39.tar.gz
Animation: Fix reset value when adding new Bezier track
Fixes #81929. In Float and Integer types, there is no subindex – only the primary value. Currently, trying to retrieve a subindex from these types in the Variant leads to a return value of null. To address this, the proposed change ensures that the default value is returned for these types instead of attempting an invalid subindex retrieval.
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index baf2c6502f..b6636ca576 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -4429,7 +4429,7 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
for (int i = 0; i < subindices.size(); i++) {
InsertData id = p_id;
id.type = Animation::TYPE_BEZIER;
- id.value = p_id.value.get(subindices[i].substr(1, subindices[i].length()));
+ id.value = subindices[i].is_empty() ? p_id.value : p_id.value.get(subindices[i].substr(1, subindices[i].length()));
id.path = String(p_id.path) + subindices[i];
p_next_tracks = _confirm_insert(id, p_next_tracks, p_reset_wanted, p_reset_anim, false);
}