From 5f5fbca95918e92d4db0e123d08a242d9e169c4b Mon Sep 17 00:00:00 2001 From: john30 Date: Sun, 10 Apr 2016 12:17:40 +0200 Subject: [PATCH] fix for traversing instructions --- src/lib/ebus/message.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/ebus/message.cpp b/src/lib/ebus/message.cpp index 3796536b..a350cd03 100644 --- a/src/lib/ebus/message.cpp +++ b/src/lib/ebus/message.cpp @@ -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 remove; for (map >::iterator it = m_instructions.begin(); it != m_instructions.end(); it++) { vector 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::iterator it = remove.begin(); it != remove.end(); it++) { + m_instructions.erase(*it); + } return overallResult; }