Commit f1a05f07 authored by D-AIRY's avatar D-AIRY

Fixed potentially crash

parent 0dd8c362
......@@ -542,7 +542,10 @@ bool CPhyWorld::importGeom(const char * file)
{
m_pGeomStaticCollideShape = importer->getCollisionShapeByName("m_pGeomStaticCollideShape");
m_pGeomStaticRigidBody = importer->getRigidBodyByName("m_pGeomStaticRigidBody");
m_pGeomStaticRigidBody->setCollisionFlags(m_pGeomStaticRigidBody->getCollisionFlags() | btCollisionObject::CF_DISABLE_VISUALIZE_OBJECT);
if(m_pGeomStaticRigidBody)
{
m_pGeomStaticRigidBody->setCollisionFlags(m_pGeomStaticRigidBody->getCollisionFlags() | btCollisionObject::CF_DISABLE_VISUALIZE_OBJECT);
}
m_iGreenShapes = -1;
char str[64];
......@@ -666,11 +669,14 @@ bool CPhyWorld::exportGeom(const char * _file)
btDefaultSerializer * serializer = new btDefaultSerializer();
serializer->startSerialization();
serializer->registerNameForPointer(m_pGeomStaticCollideShape, _allocStr("m_pGeomStaticCollideShape"));
serializer->registerNameForPointer(m_pGeomStaticRigidBody, _allocStr("m_pGeomStaticRigidBody"));
if(m_pGeomStaticCollideShape && m_pGeomStaticRigidBody)
{
serializer->registerNameForPointer(m_pGeomStaticCollideShape, _allocStr("m_pGeomStaticCollideShape"));
serializer->registerNameForPointer(m_pGeomStaticRigidBody, _allocStr("m_pGeomStaticRigidBody"));
m_pGeomStaticCollideShape->serializeSingleShape(serializer);
m_pGeomStaticRigidBody->serializeSingleObject(serializer);
m_pGeomStaticCollideShape->serializeSingleShape(serializer);
m_pGeomStaticRigidBody->serializeSingleObject(serializer);
}
char str[64];
for(int i = 0; i < m_iGreenShapes; ++i)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment