[Bf-blender-cvs] [a8ee74e] fracture_modifier: fix for rare crash at loading stored constraints

Martin Felke noreply at git.blender.org
Mon Apr 4 10:54:42 CEST 2016


Commit: a8ee74ed61a0a2e6fc981ee2cb6a9f6a9d7a156c
Author: Martin Felke
Date:   Mon Apr 4 10:54:19 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rBa8ee74ed61a0a2e6fc981ee2cb6a9f6a9d7a156c

fix for rare crash at loading stored constraints

added a null pointer check so to prevent a crash atleast

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index aedc811..b7656a7 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5297,10 +5297,17 @@ static void load_fracture_modifier(FileData* fd, FractureModifierData *fmd)
 				con->mi2 = newdataadr(fd, con->mi2);
 				con->physics_constraint = NULL;
 				con->flag |= RBC_FLAG_NEEDS_VALIDATE;
-				con->mi1->participating_constraints[con->mi1->participating_constraint_count] = con;
-				con->mi2->participating_constraints[con->mi2->participating_constraint_count] = con;
-				con->mi1->participating_constraint_count++;
-				con->mi2->participating_constraint_count++;
+				if (con->mi1->participating_constraints != NULL)
+				{
+					con->mi1->participating_constraints[con->mi1->participating_constraint_count] = con;
+					con->mi1->participating_constraint_count++;
+				}
+
+				if (con->mi2->participating_constraints != NULL)
+				{
+					con->mi2->participating_constraints[con->mi2->participating_constraint_count] = con;
+					con->mi2->participating_constraint_count++;
+				}
 			}
 
 			if (fmd->meshConstraints.first == NULL || fmd->meshConstraints.last == NULL)




More information about the Bf-blender-cvs mailing list