diff --git a/src/race/highscore_manager.cpp b/src/race/highscore_manager.cpp index 92c80c260..6748c8aa7 100644 --- a/src/race/highscore_manager.cpp +++ b/src/race/highscore_manager.cpp @@ -106,7 +106,16 @@ void HighscoreManager::loadHighscores() for(unsigned int i=0; igetNumNodes(); i++) { const XMLNode *node = root->getNode(i); - Highscores *highscores = new Highscores(*node); + Highscores *highscores; + try + { + highscores = new Highscores(*node); + } + catch (std::logic_error& e) + { + fprintf(stderr, "Invalid highscore entry will be skipped : %s\n", e.what()); + continue; + } m_all_scores.push_back(highscores); } // next entry diff --git a/src/race/highscores.cpp b/src/race/highscores.cpp index 5f3468179..80313ccdc 100644 --- a/src/race/highscores.cpp +++ b/src/race/highscores.cpp @@ -83,8 +83,14 @@ void Highscores::readEntry(const XMLNode &node) entry->get("kartname", &m_kart_name[i] ); // a non-empty entry needs a non-empty kart name. - assert(m_time[i] <= 0.0f || m_kart_name[i].size() > 0); - assert(m_time[i] <= 0.0f || m_name[i].size() > 0); + if (!(m_time[i] <= 0.0f || m_kart_name[i].size() > 0)) + { + throw std::logic_error("Invalid highscore entry : empty kart name"); + } + if (!(m_time[i] <= 0.0f || m_name[i].size() > 0)) + { + throw std::logic_error("Invalid highscore entry : empty kart name"); + } } } // readEntry