summaryrefslogtreecommitdiff
path: root/SDL_Core/src/components/application_manager/src/request_controller.cc
diff options
context:
space:
mode:
authorBrendan Shanks <bshanks@audiovox.com>2014-04-01 20:59:13 -0700
committerJustin Dickow <jjdickow@gmail.com>2014-04-02 16:02:56 -0400
commit2b8d4aa3d31b8d8c5b30ec19fe9284f566ca96cd (patch)
tree94981429674920a7084b557961dc77372780c7b7 /SDL_Core/src/components/application_manager/src/request_controller.cc
parent0cf8dbf96636e7d07b9bad9633bc1965b40e1bec (diff)
downloadsmartdevicelink-2b8d4aa3d31b8d8c5b30ec19fe9284f566ca96cd.tar.gz
request_controller: Don't advance STL iterator already at end()
Advancing an STL vector iterator which is equal to end() is undefined. After erase(), it was not being compared to end() before being incremented. Make sure the iterator gets compared to end() before incrementing again MSVC was throwing a runtime exception for this.
Diffstat (limited to 'SDL_Core/src/components/application_manager/src/request_controller.cc')
-rw-r--r--SDL_Core/src/components/application_manager/src/request_controller.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/SDL_Core/src/components/application_manager/src/request_controller.cc b/SDL_Core/src/components/application_manager/src/request_controller.cc
index 5021f721b..57e8b77c6 100644
--- a/SDL_Core/src/components/application_manager/src/request_controller.cc
+++ b/SDL_Core/src/components/application_manager/src/request_controller.cc
@@ -152,13 +152,15 @@ void RequestController::terminateAppRequests(
{
AutoLock auto_lock(request_list_lock_);
std::list<Request>::iterator it = request_list_.begin();
- for (; request_list_.end() != it; ++it) {
+ while (request_list_.end() != it) {
const commands::CommandRequestImpl* request_impl =
static_cast<commands::CommandRequestImpl*>(it->get());
if (request_impl->connection_key() == app_id) {
watchdog_->removeRequest(
request_impl->connection_key(), request_impl->correlation_id());
it = request_list_.erase(it);
+ } else {
+ ++it;
}
}
}