[Bf-blender-cvs] [e510259377e] fracture_modifier: crash fix for using Final Solid if derivedFinal is NULL

Martin Felke noreply at git.blender.org
Wed Jan 16 16:47:08 CET 2019


Commit: e510259377e1c528a8a4c045a17b97e939bcaf90
Author: Martin Felke
Date:   Wed Jan 16 16:46:50 2019 +0100
Branches: fracture_modifier
https://developer.blender.org/rBe510259377e1c528a8a4c045a17b97e939bcaf90

crash fix for using Final Solid if derivedFinal is NULL

was missing a nullpointer check, fallback is to return a DM of the basemesh

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

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

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 0c7e93ffbc0..c50d1a93e93 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -320,9 +320,14 @@ static DerivedMesh *rigidbody_get_mesh(Object *ob)
 	else if (ob->rigidbody_object->mesh_source == RBO_MESH_FINAL) {
 		return ob->derivedFinal;
 	}
-	else if (ob->rigidbody_object->mesh_source == RBO_MESH_FINAL_SOLID)
-	{
-		return dm_solidify(ob->derivedFinal, ob->rigidbody_object->margin);
+	else if (ob->rigidbody_object->mesh_source == RBO_MESH_FINAL_SOLID) {
+		if (ob->derivedFinal) {
+			return dm_solidify(ob->derivedFinal, ob->rigidbody_object->margin);
+		}
+		else {
+			// fallback to avoid crash
+			return CDDM_from_mesh(ob->data);
+		}
 	}
 	else {
 		return CDDM_from_mesh(ob->data);



More information about the Bf-blender-cvs mailing list