fix for traversing instructions

This commit is contained in:
john30
2016-04-10 12:17:40 +02:00
parent cff5dd2952
commit 5f5fbca959
+5 -1
View File
@@ -1587,6 +1587,7 @@ result_t MessageMap::resolveCondition(Condition* condition) {
result_t MessageMap::executeInstructions(bool verbose, ostringstream& log) {
m_lastError = "";
result_t overallResult = RESULT_OK;
vector<string> remove;
for (map<string, vector<Instruction*> >::iterator it = m_instructions.begin(); it != m_instructions.end(); it++) {
vector<Instruction*> instructions = it->second;
bool removeSingletons = false;
@@ -1633,11 +1634,14 @@ result_t MessageMap::executeInstructions(bool verbose, ostringstream& log) {
}
}
if (remain.empty()) {
m_instructions.erase(it--);
remove.push_back(it->first);
} else {
it->second = remain;
}
}
for (vector<string>::iterator it = remove.begin(); it != remove.end(); it++) {
m_instructions.erase(*it);
}
return overallResult;
}