summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-11-28 13:37:06 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-11-28 13:37:06 +0100
commit83ae2b158f19cf44a2431514175a351794fe0c2e (patch)
treebc8f075d05b38551aaaebb15b7ab96086a82a932
parentf82bf35a03502b33e0b3a5987573e3c6987912ce (diff)
parenta3632694794ae78ce36302e4eac672caf771a607 (diff)
downloadredot-engine-83ae2b158f19cf44a2431514175a351794fe0c2e.tar.gz
Merge pull request #85461 from akien-mga/AnimationMixer-validate-object-before-blend
AnimationMixer: Validate ObjectID before blend in case the object was freed
-rw-r--r--scene/animation/animation_mixer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp
index 479311e966..bba3dc6d7d 100644
--- a/scene/animation/animation_mixer.cpp
+++ b/scene/animation/animation_mixer.cpp
@@ -1708,7 +1708,12 @@ void AnimationMixer::_blend_apply() {
}
}
}
- t->object->set_indexed(t->subpath, Animation::cast_from_blendwise(t->value, t->init_value.get_type()));
+
+ // t->object isn't safe here, get instance from id (GH-85365).
+ Object *obj = ObjectDB::get_instance(t->object_id);
+ if (obj) {
+ obj->set_indexed(t->subpath, Animation::cast_from_blendwise(t->value, t->init_value.get_type()));
+ }
} break;
case Animation::TYPE_BEZIER: {