Merge pull request #51541 from timothyqiu/reset-crash

Fixes crash when AnimationPlayer reset on save
This commit is contained in:
Rémi Verschelde 2021-08-12 08:11:46 +02:00 committed by GitHub
commit f88593ce5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}