Fix crash when track is not found.

This commit is contained in:
hiker 2014-12-22 08:20:19 +11:00
parent 89317ce399
commit 8e142daa00

View File

@ -76,7 +76,6 @@ void ParticleKindManager::cleanUpTrackSpecificGfx()
ParticleKind* ParticleKindManager::getParticles(const std::string &name)
{
Track* t = track_manager->getTrack(race_manager->getTrackName());
std::map<std::string, ParticleKind*>::iterator i;
i = m_per_track_kinds.find(name);
if (i != m_per_track_kinds.end())
@ -86,11 +85,15 @@ ParticleKind* ParticleKindManager::getParticles(const std::string &name)
else
{
try
{
Track* t = track_manager->getTrack(race_manager->getTrackName());
if (t)
{
ParticleKind* newkind = new ParticleKind(t->getTrackFile(name));
m_per_track_kinds[name] = newkind;
return newkind;
}
}
catch (std::runtime_error& e)
{
(void)e; // remove compiler warning