[Bf-blender-cvs] [5ad7a24] fracture_modifier: fixed two crashers: 1) when object had no material, that assignment failed. 2) constraints with empty meshislands crashed too

Martin Felke noreply at git.blender.org
Tue Jan 26 01:03:40 CET 2016


Commit: 5ad7a248a3d972ea7aa7df261c85539610460ab8
Author: Martin Felke
Date:   Tue Jan 26 01:03:12 2016 +0100
Branches: fracture_modifier
https://developer.blender.org/rB5ad7a248a3d972ea7aa7df261c85539610460ab8

fixed two crashers: 1) when object had no material, that assignment failed. 2) constraints with empty meshislands crashed too

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

M	source/blender/blenkernel/intern/fracture.c

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

diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 3df1565..b3d0c67 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -2382,7 +2382,12 @@ int BKE_fracture_update_visual_mesh(FractureModifierData *fmd, bool do_custom_da
 			/* material index lookup and correction, avoid having the same material in different slots */
 			int index = GET_INT_FROM_POINTER(BLI_ghash_lookup(fmd->material_index_map,
 			                                 SET_INT_IN_POINTER(mp->mat_nr + matstart)));
-			mp->mat_nr = index-1;
+
+			if (index > 0)
+				index--;
+
+			mp->mat_nr = index;
+
 		}
 
 		/* fortunately we know how many faces "belong" to this meshisland, too */
@@ -2628,6 +2633,9 @@ RigidBodyShardCon *BKE_fracture_mesh_islands_connect(FractureModifierData *fmd,
 {
 	RigidBodyShardCon *rbsc;
 
+	if (mi1 == NULL || mi2 == NULL)
+		return NULL;
+
 	rbsc = BKE_rigidbody_create_shard_constraint(fmd->modifier.scene, con_type, false);
 	rbsc->mi1 = mi1;
 	rbsc->mi2 = mi2;




More information about the Bf-blender-cvs mailing list