[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28984] trunk/blender/source/blender/ blenloader/intern/readfile.c: NULL check for parent with do_versions(),

Campbell Barton ideasman42 at gmail.com
Tue May 25 20:31:37 CEST 2010


Revision: 28984
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28984
Author:   campbellbarton
Date:     2010-05-25 20:31:36 +0200 (Tue, 25 May 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-05-25 17:04:32 UTC (rev 28983)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-05-25 18:31:36 UTC (rev 28984)
@@ -10878,31 +10878,33 @@
 		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);
+				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;
+						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;
+						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;
+						cmd = (CurveModifierData*) modifier_new(eModifierType_Curve);
+						cmd->object = ob->parent;
+						BLI_addtail((ListBase*)&ob->modifiers, cmd);
+						ob->partype = PAROBJECT;
+					}
 				}
 			}
 		}





More information about the Bf-blender-cvs mailing list