Prevent a crash when calling AnimationMixer::restore when an invalid reference

(cherry picked from commit 937411e152)
This commit is contained in:
jsjtxietian 2023-11-28 12:54:06 +08:00 committed by Rémi Verschelde
parent cff941f138
commit 2786f0e43e
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -1985,6 +1985,7 @@ void AnimationMixer::reset() {
} }
void AnimationMixer::restore(const Ref<AnimatedValuesBackup> &p_backup) { void AnimationMixer::restore(const Ref<AnimatedValuesBackup> &p_backup) {
ERR_FAIL_COND(p_backup.is_null());
track_cache = p_backup->get_data(); track_cache = p_backup->get_data();
_blend_apply(); _blend_apply();
track_cache = HashMap<NodePath, AnimationMixer::TrackCache *>(); track_cache = HashMap<NodePath, AnimationMixer::TrackCache *>();