summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
index 768502832d..61524546a8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
@@ -296,6 +296,11 @@ smart_objects::SmartObject RCHelpers::MergeModuleData(
smart_objects::SmartObject result = data1;
+ if (data2.empty()) {
+ SDL_LOG_ERROR("Data received from module is empty");
+ return result;
+ }
+
for (auto it = data2.map_begin(); it != data2.map_end(); ++it) {
const std::string& key = it->first;
smart_objects::SmartObject& value = it->second;
@@ -305,9 +310,9 @@ smart_objects::SmartObject RCHelpers::MergeModuleData(
}
// Merge maps and arrays with `id` param included, replace other types
- if (value.getType() == smart_objects::SmartType::SmartType_Map) {
+ if (smart_objects::SmartType::SmartType_Map == value.getType()) {
value = MergeModuleData(result[key], value);
- } else if (value.getType() == smart_objects::SmartType::SmartType_Array) {
+ } else if (smart_objects::SmartType::SmartType_Array == value.getType()) {
value = MergeArray(result[key], value);
}
result[key] = value;