Jelajahi Sumber

Merge pull request #85461 from akien-mga/AnimationMixer-validate-object-before-blend

AnimationMixer: Validate ObjectID before blend in case the object was freed
Rémi Verschelde 1 tahun lalu
induk
melakukan
83ae2b158f
1 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 6 1
      scene/animation/animation_mixer.cpp

+ 6 - 1
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: {