some fixes in a recent contribution, added return values and check for valid pointer, to avoid crashes.
This commit is contained in:
@@ -1602,6 +1602,8 @@ KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc){//not used
|
|||||||
return gameobje->GetPhysicsController();
|
return gameobje->GetPhysicsController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist){
|
KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist){
|
||||||
@@ -1613,6 +1615,8 @@ KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist){
|
|||||||
return gameobje;
|
return gameobje;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert blender objects into ketsji gameobjects
|
// convert blender objects into ketsji gameobjects
|
||||||
@@ -1945,6 +1949,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
|||||||
if (dat->tar)
|
if (dat->tar)
|
||||||
{
|
{
|
||||||
KX_GameObject *gotar=getGameOb(dat->tar->id.name,sumolist);
|
KX_GameObject *gotar=getGameOb(dat->tar->id.name,sumolist);
|
||||||
|
if (gotar)
|
||||||
physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
|
physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user