Fix use of unintialized pointer and improve error reporting

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10840 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-02-13 23:23:10 +00:00
parent 5b6e31639c
commit 418aaf84e7
2 changed files with 7 additions and 3 deletions

View File

@ -472,7 +472,8 @@ void Track::convertTrackToBullet(scene::ISceneNode *node)
node = ((LODNode*)node)->getFirstNode();
if (node == NULL)
{
fprintf(stderr, "[Track] WARNING: this track contains an empty LOD group\n");
fprintf(stderr, "[Track] WARNING: this track contains an empty LOD group : '%s'\n",
((LODNode*)node)->getGroupName().c_str());
return;
}
}

View File

@ -45,6 +45,7 @@ TrackObject::TrackObject(const XMLNode &xml_node)
m_enabled = true;
m_is_looped = false;
m_sound = NULL;
m_mesh = NULL;
xml_node.get("xyz", &m_init_xyz );
xml_node.get("hpr", &m_init_hpr );
@ -136,6 +137,7 @@ TrackObject::TrackObject(const XMLNode &xml_node)
{
std::string full_path =
World::getWorld()->getTrack()->getTrackFile(model_name);
if(file_manager->fileExists(full_path))
{
m_mesh = irr_driver->getAnimatedMesh(full_path);
@ -146,11 +148,12 @@ TrackObject::TrackObject(const XMLNode &xml_node)
// in STK's model directory.
full_path = file_manager->getModelFile(model_name);
m_mesh = irr_driver->getAnimatedMesh(full_path);
if(!m_mesh)
{
fprintf(stderr,
"Warning: '%s' in '%s' not found and is ignored.\n",
xml_node.getName().c_str(), model_name.c_str());
"Warning: model '%s' in node '%s' not found and is ignored.\n",
model_name.c_str(), xml_node.getName().c_str());
return;
} // if(!m_mesh)
}