Avoid crashing when checklines are incorrect

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8818 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2011-06-04 23:31:31 +00:00
parent cdb2a7dab6
commit d24d70a2f8
2 changed files with 6 additions and 1 deletions

View File

@@ -41,7 +41,10 @@ public:
void reset(const Track &track);
/** Returns the nth. check structure. */
CheckStructure *getCheckStructure(unsigned int n)
{ return m_all_checks[n]; }
{
if (n >= m_all_checks.size()) return NULL;
return m_all_checks[n];
}
}; // CheckManager
#endif

View File

@@ -129,6 +129,8 @@ void CheckStructure::changeStatus(const std::vector<int> indices,
{
CheckStructure *cs =
m_check_manager->getCheckStructure(indices[i]);
if (cs == NULL) continue;
switch(change_state)
{
case CS_DEACTIVATE: