replace unecessary NULL-checks

This commit is contained in:
konstin
2014-08-18 15:11:51 +02:00
parent fcb80cdb2c
commit 2f6424c3a2

View File

@@ -205,6 +205,9 @@ void GrandPrixEditorScreen::loadGPList()
// Reset GP list everytime (accounts for locking changes, etc.)
gplist_widget->clearItems();
// ensures that no GP and no track is NULL
grand_prix_manager->checkConsistency();
// Build GP list
for (unsigned int i = 0; i < grand_prix_manager->getNumberOfGrandPrix(); i++)
{
@@ -215,23 +218,7 @@ void GrandPrixEditorScreen::loadGPList()
for (unsigned int t=0; t<tracks.size(); t++)
{
Track* track = track_manager->getTrack(tracks[t]);
if (track == NULL)
{
Log::warn("GrandPrixEditor",
"Grand Prix '%s' refers to track '%s', which does not exist\n",
gp->getId().c_str(), tracks[t].c_str());
}
else
{
sshot_files.push_back(track->getScreenshotFile());
}
}
if (sshot_files.size() == 0)
{
Log::warn("GrandPrixEditor",
"Grand Prix '%s' does not contain any valid track\n",
gp->getId().c_str());
sshot_files.push_back("gui/main_help.png");
sshot_files.push_back(track->getScreenshotFile());
}
gplist_widget->addAnimatedItem(translations->fribidize(gp->getName()), gp->getId(),