From bf93c1353f2f79cbfd3c60395b153e1ea18e4488 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 27 Jan 2014 18:40:36 +0000 Subject: [PATCH] Corrected poor code in API. --- src/api/api.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/api/api.cpp b/src/api/api.cpp index dbcddd95..6eaafcb0 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -328,7 +328,7 @@ BOSS_API unsigned int boss_eval_lists (boss_db db, const unsigned int language) std::list temp = db->rawMetadata; try { db->game.RefreshActivePluginsList(); - for (std::list::iterator it=temp.begin(); it != temp.end(); ++it) { + for (std::list::iterator it=temp.begin(); it != temp.end();) { it->EvalAllConditions(db->game, language); if (it->IsRegexPlugin()) { boost::regex regex; @@ -347,7 +347,9 @@ BOSS_API unsigned int boss_eval_lists (boss_db db, const unsigned int language) temp.push_back(p); } } - temp.erase(it--); + it = temp.erase(it); + } else { + ++it; } } } catch (boss::error& e) { @@ -358,7 +360,7 @@ BOSS_API unsigned int boss_eval_lists (boss_db db, const unsigned int language) temp = db->rawUserMetadata; try { - for (std::list::iterator it=temp.begin(); it != temp.end(); ++it) { + for (std::list::iterator it=temp.begin(); it != temp.end();) { it->EvalAllConditions(db->game, language); if (it->IsRegexPlugin()) { boost::regex regex; @@ -377,7 +379,9 @@ BOSS_API unsigned int boss_eval_lists (boss_db db, const unsigned int language) temp.push_back(p); } } - temp.erase(it--); + it = temp.erase(it); + } else { + ++it; } } } catch (boss::error& e) {