better error handling
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10680 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d6221dae92
commit
9f69dad8a3
@ -418,7 +418,16 @@ bool AddonsManager::install(const Addon &addon)
|
||||
Track *track = track_manager->getTrack(addon.getId());
|
||||
if(track)
|
||||
track_manager->removeTrack(addon.getId());
|
||||
track_manager->loadTrack(addon.getDataDir());
|
||||
|
||||
try
|
||||
{
|
||||
track_manager->loadTrack(addon.getDataDir());
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
fprintf(stderr, "[AddonsManager] ERROR: Cannot load track <%s> : %s\n",
|
||||
addon.getDataDir().c_str(), e.what());
|
||||
}
|
||||
}
|
||||
saveInstalled();
|
||||
return true;
|
||||
|
@ -156,7 +156,19 @@ bool TrackManager::loadTrack(const std::string& dirname)
|
||||
if(!f) return false;
|
||||
fclose(f);
|
||||
|
||||
Track *track = new Track(config_file);
|
||||
Track *track;
|
||||
|
||||
try
|
||||
{
|
||||
track = new Track(config_file);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
fprintf(stderr, "[TrackManager] ERROR: Cannot load track <%s> : %s\n",
|
||||
dirname.c_str(), e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(track->getVersion()<stk_config->m_min_track_version ||
|
||||
track->getVersion()>stk_config->m_max_track_version)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user