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:
2019-08-06 14:32:29 +02:00
parent dcad1eb03c
commit 39f005eae8

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)