Improved handling if default (i.e. previously selected) kart

can not be found. Now stk will only abort if no kart at all
can be found, otherwise use the first kart in the kart 
properties list.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5943 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-09 03:24:34 +00:00
parent 5abf327e13
commit aef6a4024c

View File

@ -301,8 +301,18 @@ public:
const KartProperties* props = kart_properties_manager->getKart(default_kart);
if(!props)
{
fprintf(stderr, "Can't find default kart '%s' - aborting.\n",
default_kart.c_str());
// If the default kart can't be found (e.g. previously a addon
// kart was used, but the addon package was removed, use the
// first kart as a default. This way we don't have to hardcode
// any kart names.
props = kart_properties_manager->getKartById(0);
if(!props)
{
fprintf(stderr,
"Can't find default kart '%s' nor any other kart.\n",
default_kart.c_str());
exit(-1);
}
}
KartModel* kartModel = props->getKartModel();