Do not crash if used addon track not found in local STK
This commit is contained in:
parent
05093852bc
commit
bd1380a240
@ -25,6 +25,7 @@
|
|||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "race/race_manager.hpp"
|
#include "race/race_manager.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
#include <irrlicht.h>
|
#include <irrlicht.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -132,11 +133,19 @@ void ReplayPlay::loadAllReplayFile()
|
|||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if (sscanf(s, "track: %s", s1) != 1)
|
if (sscanf(s, "track: %s", s1) != 1)
|
||||||
{
|
{
|
||||||
Log::warn("Replay", "Track not found in replay file.");
|
Log::warn("Replay", "Track info not found in replay file.");
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
rd.m_track_name = std::string(s1);
|
rd.m_track_name = std::string(s1);
|
||||||
|
Track* t = track_manager->getTrack(rd.m_track_name);
|
||||||
|
if (t == NULL)
|
||||||
|
{
|
||||||
|
Log::warn("Replay", "Track '%s' used in replay not found in STK!",
|
||||||
|
rd.m_track_name.c_str());
|
||||||
|
fclose(fd);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if (sscanf(s, "laps: %u", &rd.m_laps) != 1)
|
if (sscanf(s, "laps: %u", &rd.m_laps) != 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user