BGE: fix bug #26775, crash when physics constraint is defined on non-active objects. Patch provided by Sergey Sharybin, verified and applied.

This commit is contained in:
Benoit Bolsee 2011-05-30 15:40:01 +00:00
parent c141ed0aa9
commit 884b9d1557

@ -2608,6 +2608,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
bConstraint *curcon;
conlist = get_active_constraints2(blenderobject);
if((gameobj->GetLayer()&activeLayerBitInfo)==0)
continue;
if (conlist) {
for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) {
if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT){
@ -2621,7 +2624,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
if (dat->tar)
{
KX_GameObject *gotar=getGameOb(dat->tar->id.name+2,sumolist);
if (gotar && gotar->GetPhysicsController())
if (gotar && ((gotar->GetLayer()&activeLayerBitInfo)!=0) && gotar->GetPhysicsController())
physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
}