Commit: ffee7f1a58a18bc08add94176ddffe29809139a6
Author: Sybren A. Stüvel
Date:   Wed Mar 4 13:21:38 2015 +0100
Branches: master
https://developer.blender.org/rBffee7f1a58a18bc08add94176ddffe29809139a6

BGE: Fix crash when a constraint misses its reference object

Blender allows you to create a constraint without specifying its reference
object, even when the constraint requires such a reference. The BGE would
crash on this. This change simply ignores such a constraint.

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

M       source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

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

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 557b529..ac74029 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -2644,7 +2644,9 @@ int                       
CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl
        if (!rb0)
                return 0;
 
-       
+       // If either of the controllers is missing, we can't do anything.
+       if (!c0 || !c1) return 0;
+
        btVector3 pivotInB = rb1 ? 
rb1->getCenterOfMassTransform().inverse()(rb0->getCenterOfMassTransform()(pivotInA))
 : 
                rb0->getCenterOfMassTransform() * pivotInA;
        btVector3 axisInA(axisX,axisY,axisZ);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to