mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-14 06:40:40 +00:00
protection for null cast
This commit is contained in:
parent
0fa1dea6c1
commit
05687c120f
@ -37,9 +37,11 @@ namespace Physic
|
|||||||
pmove = new playerMove;
|
pmove = new playerMove;
|
||||||
pmove->mEngine = mEngine;
|
pmove->mEngine = mEngine;
|
||||||
btBoxShape* box = static_cast<btBoxShape*> (mBody->getCollisionShape());
|
btBoxShape* box = static_cast<btBoxShape*> (mBody->getCollisionShape());
|
||||||
btVector3 size = box->getHalfExtentsWithMargin();
|
if(box != NULL){
|
||||||
Ogre::Vector3 halfExtents = Ogre::Vector3(size.getX(), size.getY(), size.getZ());
|
btVector3 size = box->getHalfExtentsWithMargin();
|
||||||
pmove->ps.halfExtents = halfExtents;
|
Ogre::Vector3 halfExtents = Ogre::Vector3(size.getX(), size.getY(), size.getZ());
|
||||||
|
pmove->ps.halfExtents = halfExtents;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicActor::~PhysicActor()
|
PhysicActor::~PhysicActor()
|
||||||
@ -147,9 +149,11 @@ namespace Physic
|
|||||||
mBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation);
|
mBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation);
|
||||||
mEngine->addRigidBody(mBody, false); //Add rigid body to dynamics world, but do not add to object map
|
mEngine->addRigidBody(mBody, false); //Add rigid body to dynamics world, but do not add to object map
|
||||||
btBoxShape* box = static_cast<btBoxShape*> (mBody->getCollisionShape());
|
btBoxShape* box = static_cast<btBoxShape*> (mBody->getCollisionShape());
|
||||||
btVector3 size = box->getHalfExtentsWithMargin();
|
if(box != NULL){
|
||||||
Ogre::Vector3 halfExtents = Ogre::Vector3(size.getX(), size.getY(), size.getZ());
|
btVector3 size = box->getHalfExtentsWithMargin();
|
||||||
pmove->ps.halfExtents = halfExtents;
|
Ogre::Vector3 halfExtents = Ogre::Vector3(size.getX(), size.getY(), size.getZ());
|
||||||
|
pmove->ps.halfExtents = halfExtents;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicActor::runPmove(){
|
void PhysicActor::runPmove(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user