Avoid referencing a null pointer when kart loading failed

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10316 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-12-03 23:19:49 +00:00
parent bb78f07b4c
commit 55df795334

View File

@ -153,7 +153,7 @@ KartModel::~KartModel()
}
}
if(m_is_master)
if(m_is_master && m_mesh != NULL)
{
irr_driver->dropAllTextures(m_mesh);
irr_driver->removeMeshFromCache(m_mesh);
@ -284,13 +284,13 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
assert(m_is_master);
std::string full_path = kart_properties.getKartDir()+"/"+m_model_filename;
m_mesh = irr_driver->getAnimatedMesh(full_path);
irr_driver->grabAllTextures(m_mesh);
if(!m_mesh)
{
printf("Problems loading mesh '%s' - kart '%s' will not be available\n",
full_path.c_str(), kart_properties.getIdent().c_str());
full_path.c_str(), kart_properties.getIdent().c_str());
return false;
}
irr_driver->grabAllTextures(m_mesh);
Vec3 min, max;
MeshTools::minMax3D(m_mesh->getMesh(m_animation_frame[AF_STRAIGHT]), &min, &max);