diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-05-25 22:31:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-05-25 22:31:36 +0400 |
commit | 244cda6f1ae3a0311c118953197704f1391eb702 (patch) | |
tree | 09c1d35ba32336b8d0e022d868e1d80fae891d31 | |
parent | 1bd58bdbf4fb6e5723adea04ebb6eb5ad2918297 (diff) |
NULL check for parent with do_versions(),
this is also done in the 2 others places in the code which get the parent.
In our case the crash was caused by a group not containing the parent object.
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9125a255333..4000669c30e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10878,31 +10878,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for(ob = main->object.first; ob; ob = ob->id.next) { if(ob->parent) { Object *parent= (Object *)newlibadr(fd, lib, ob->parent); - if(parent->type==OB_ARMATURE && ob->partype==PARSKEL) { - ArmatureModifierData *amd; - bArmature *arm= (bArmature *)newlibadr(fd, lib, parent->data); - - amd = (ArmatureModifierData*) modifier_new(eModifierType_Armature); - amd->object = ob->parent; - BLI_addtail((ListBase*)&ob->modifiers, amd); - amd->deformflag= arm->deformflag; - ob->partype = PAROBJECT; - } - else if(parent->type==OB_LATTICE && ob->partype==PARSKEL) { - LatticeModifierData *lmd; - - lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice); - lmd->object = ob->parent; - BLI_addtail((ListBase*)&ob->modifiers, lmd); - ob->partype = PAROBJECT; - } - else if(parent->type==OB_CURVE && ob->partype==PARCURVE) { - CurveModifierData *cmd; - - cmd = (CurveModifierData*) modifier_new(eModifierType_Curve); - cmd->object = ob->parent; - BLI_addtail((ListBase*)&ob->modifiers, cmd); - ob->partype = PAROBJECT; + if(parent) { /* parent may not be in group */ + if(parent->type==OB_ARMATURE && ob->partype==PARSKEL) { + ArmatureModifierData *amd; + bArmature *arm= (bArmature *)newlibadr(fd, lib, parent->data); + + amd = (ArmatureModifierData*) modifier_new(eModifierType_Armature); + amd->object = ob->parent; + BLI_addtail((ListBase*)&ob->modifiers, amd); + amd->deformflag= arm->deformflag; + ob->partype = PAROBJECT; + } + else if(parent->type==OB_LATTICE && ob->partype==PARSKEL) { + LatticeModifierData *lmd; + + lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice); + lmd->object = ob->parent; + BLI_addtail((ListBase*)&ob->modifiers, lmd); + ob->partype = PAROBJECT; + } + else if(parent->type==OB_CURVE && ob->partype==PARCURVE) { + CurveModifierData *cmd; + + cmd = (CurveModifierData*) modifier_new(eModifierType_Curve); + cmd->object = ob->parent; + BLI_addtail((ListBase*)&ob->modifiers, cmd); + ob->partype = PAROBJECT; + } } } } |