summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2021-08-12 10:53:35 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2021-08-12 10:53:35 +0800
commit96f077a18d7d1bfc710233b467810f6f7e39b4ce (patch)
tree6fd81fb305b024e39f4558aa3b1e6f23281c4c06 /editor
parent7188cb60127c1f4e900f080adbc47a55645f1645 (diff)
Fixes crash when AnimationPlayer reset on save
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 8748d021b6..30edbd1e87 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1606,7 +1606,9 @@ static void _reset_animation_players(Node *p_node, List<Ref<AnimatedValuesBackup
AnimationPlayer *player = Object::cast_to<AnimationPlayer>(p_node->get_child(i));
if (player && player->is_reset_on_save_enabled() && player->can_apply_reset()) {
Ref<AnimatedValuesBackup> old_values = player->apply_reset();
- r_anim_backups->push_back(old_values);
+ if (old_values.is_valid()) {
+ r_anim_backups->push_back(old_values);
+ }
}
_reset_animation_players(p_node->get_child(i), r_anim_backups);
}