Fix crash when opening files with missing armature libaries

In the case where the library is missing, the armature object is
replaced with an empty. This would crash the armature modifier.

Now we check if the armature object really is an armature or not.
This commit is contained in:
Sebastian Parborg 2019-08-06 14:32:29 +02:00
parent dcad1eb03c
commit 39f005eae8
Notes: blender-bot 2023-02-14 10:21:15 +01:00
Referenced by commit 6d64da1e67, Fix potential issues when loading files with missing libraries
1 changed files with 6 additions and 1 deletions

View File

@ -79,7 +79,12 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
{
ArmatureModifierData *amd = (ArmatureModifierData *)md;
return !amd->object;
/* The object type check is only needed here in case we have a placeholder
* object assigned (because the library containing the armature is missing).
*
* In other cases it should be impossible.
*/
return !amd->object || amd->object->type != OB_ARMATURE;
}
static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData)