From: <au...@us...> - 2011-12-03 23:19:55
|
Revision: 10316 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=10316&view=rev Author: auria Date: 2011-12-03 23:19:49 +0000 (Sat, 03 Dec 2011) Log Message: ----------- Avoid referencing a null pointer when kart loading failed Modified Paths: -------------- main/trunk/src/karts/kart_model.cpp Modified: main/trunk/src/karts/kart_model.cpp =================================================================== --- main/trunk/src/karts/kart_model.cpp 2011-12-03 22:12:06 UTC (rev 10315) +++ main/trunk/src/karts/kart_model.cpp 2011-12-03 23:19:49 UTC (rev 10316) @@ -153,7 +153,7 @@ } } - 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 @@ 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |