Fix #102860: crash importing a certain dae (collada) file

There seems to not be a strict rule to only have armatures as parents to
single bones, apparently collada files can also be set up to have mesh
parents for bones. As a consequence, the collada importer
`joint_parent_map` is not safe to fetch objects from and assume their
data can be cast to `bArmature`.

Ultimately, the `joint_parent_map` needs to be looked at again, this
patch just avoids a crash in this scenario (so no such joints will be
iported). Still better than crashing I guess.

Pull Request: https://projects.blender.org/blender/blender/pulls/118751
This commit is contained in:
Philipp Oeser
2024-03-01 16:31:33 +01:00
committed by Philipp Oeser
parent 1c5766f8bc
commit f880cbce93

View File

@@ -476,6 +476,12 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *>
continue;
}
/* Assumption that joint_parent_map only lists armatures is apparently wrong (it can be meshes,
* too), this needs to be checked again, for now prevent a crash though. */
if (ob_arm->type != OB_ARMATURE) {
continue;
}
bArmature *armature = (bArmature *)ob_arm->data;
if (!armature) {
continue;