summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-10-12 16:22:47 -0400
committerJackLivio <jack@livio.io>2018-10-12 16:22:47 -0400
commitde54a96dbf1d1463ce5413e070a8a73fb832b572 (patch)
tree657740eb4a377599715337e05887f9d5a16f2c23
parent5aa5123c5b13f3acd024f720a1d3367e371911c4 (diff)
downloadsdl_core-de54a96dbf1d1463ce5413e070a8a73fb832b572.tar.gz
Ensure erase does not invalidate iterator
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
index f5077d4826..3afa2f040c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
@@ -95,10 +95,11 @@ void GetInteriorVehicleDataRequest::FilterDisabledModuleData(
// message.
if (module_data.keyExists(message_params::kRadioEnable) &&
module_data[message_params::kRadioEnable].asBool() == false) {
- for (auto data = module_data.map_begin(); data != module_data.map_end();
- ++data) {
- if (data->first != message_params::kRadioEnable) {
- module_data.erase(data->first);
+ for (auto data = module_data.map_begin(); data != module_data.map_end();) {
+ auto key = data->first;
+ ++data;
+ if (key != message_params::kRadioEnable) {
+ module_data.erase(key);
}
}
}