mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 14:56:38 +00:00 
			
		
		
		
	protection for null cast
This commit is contained in:
		
							parent
							
								
									0fa1dea6c1
								
							
						
					
					
						commit
						05687c120f
					
				
					 1 changed files with 10 additions and 6 deletions
				
			
		|  | @ -37,9 +37,11 @@ namespace Physic | |||
|         pmove = new playerMove; | ||||
|         pmove->mEngine = mEngine; | ||||
|         btBoxShape* box = static_cast<btBoxShape*> (mBody->getCollisionShape()); | ||||
|         btVector3 size = box->getHalfExtentsWithMargin(); | ||||
|         Ogre::Vector3 halfExtents = Ogre::Vector3(size.getX(), size.getY(), size.getZ()); | ||||
|         pmove->ps.halfExtents = halfExtents; | ||||
|         if(box != NULL){ | ||||
|             btVector3 size = box->getHalfExtentsWithMargin(); | ||||
|             Ogre::Vector3 halfExtents = Ogre::Vector3(size.getX(), size.getY(), size.getZ()); | ||||
|             pmove->ps.halfExtents = halfExtents; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     PhysicActor::~PhysicActor() | ||||
|  | @ -147,9 +149,11 @@ namespace Physic | |||
|         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
 | ||||
|         btBoxShape* box = static_cast<btBoxShape*> (mBody->getCollisionShape()); | ||||
|         btVector3 size = box->getHalfExtentsWithMargin(); | ||||
|         Ogre::Vector3 halfExtents = Ogre::Vector3(size.getX(), size.getY(), size.getZ()); | ||||
|         pmove->ps.halfExtents = halfExtents; | ||||
|         if(box != NULL){ | ||||
|             btVector3 size = box->getHalfExtentsWithMargin(); | ||||
|             Ogre::Vector3 halfExtents = Ogre::Vector3(size.getX(), size.getY(), size.getZ()); | ||||
|             pmove->ps.halfExtents = halfExtents; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     void PhysicActor::runPmove(){ | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue