actually. what I meant by "break" was a breakpoint for debugging, not a break statement :-D
another option would be to rewrite the function like this..
void iPhysicsWorld::DestroyBody(iPhysicsBody* apBody)
{
//STLFindAndDelete(mlstBodies, apBody);
tPhysicsBodyListIt it = mlstBodies.begin();
for(; it != mlstBodies.end();)
{
iPhysicsBody *pBody = *it;
if(pBody == apBody)
{
if(mpWorld3D) mpWorld3D->GetPortalContainer()->RemoveEntity(pBody);
pBody->Destroy();
hplDelete(pBody);
it = mlstBodies.erase(it);
} else {
++it;
}
}
}
As for your other crash. Just stick a breakpoint (usually by clicking off on the left margin of the source editor) and run the game from VS, and step through to figure out where the NULL value is coming from.