[Bf-blender-cvs] [78c9142] fracture_modifier: crash fix for: appending objects with fracture modifier from library blends without their respective scenes and attempting to fracture then to build up the modifier structures
Martin Felke
noreply at git.blender.org
Tue Oct 7 16:54:55 CEST 2014
Commit: 78c9142163f1f4a4c7604ed54116722187f2923f
Author: Martin Felke
Date: Tue Oct 7 16:54:34 2014 +0200
Branches: fracture_modifier
https://developer.blender.org/rB78c9142163f1f4a4c7604ed54116722187f2923f
crash fix for: appending objects with fracture modifier from library blends without their respective scenes and attempting to fracture then to build up the modifier structures
===================================================================
M source/blender/blenkernel/intern/rigidbody.c
===================================================================
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index f4fe2e3..4f698fd 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1937,7 +1937,9 @@ void BKE_rigidbody_remove_shard(Scene* scene, MeshIsland *mi)
RigidBodyWorld *rbw = scene->rigidbody_world;
int i = 0;
- if (mi->rigidbody != NULL) {
+ /* rbw can be NULL directly after linking / appending objects without their original scenes
+ * if an attempt to refracture is done then, this would crash here with null pointer access */
+ if (mi->rigidbody != NULL && rbw != NULL) {
RigidBodyShardCon *con;
for (i = 0; i < mi->participating_constraint_count; i++) {
@@ -1959,7 +1961,10 @@ void BKE_rigidbody_remove_shard(Scene* scene, MeshIsland *mi)
}
/* this SHOULD be the correct global index */
- if (rbw->cache_index_map != NULL)
+ /* need to check whether we didnt create the rigidbody world manually already, prior to fracture, in this
+ * case cache_index_map might be not initialized ! checking numbodies here, they should be 0 in a fresh
+ * rigidbody world */
+ if (rbw->cache_index_map != NULL && rbw->numbodies > 0)
rbw->cache_index_map[mi->linear_index] = NULL;
}
}
More information about the Bf-blender-cvs
mailing list