From 7afc7b480163098d1faa7eace9aabff497b13827 Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Wed, 26 Feb 2020 12:54:54 -0800 Subject: Fix get app properties (#3258) Co-authored-by: Maksym Ked (GitHub) <41471947+mked-luxoft@users.noreply.github.com> --- .../src/commands/hmi/bc_get_app_properties_request.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc index 57e4318c8a..0dafa21e33 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc @@ -102,13 +102,14 @@ void BCGetAppPropertiesRequest::Run() { const auto& msg_params = (*message_)[strings::msg_params]; smart_objects::SmartObject response_params(smart_objects::SmartType_Map); - smart_objects::SmartObject properties(smart_objects::SmartType_Map); if (msg_params.keyExists(strings::policy_app_id)) { const auto policy_app_id = msg_params[strings::policy_app_id].asString(); + smart_objects::SmartObject properties(smart_objects::SmartType_Map); FillAppProperties(policy_app_id, properties); - response_params[strings::properties][0] = properties; - + if (!properties.empty()) { + response_params[strings::properties][0] = properties; + } } else { LOG4CXX_DEBUG(logger_, "policyAppID was absent in request, all apps properties " @@ -116,12 +117,13 @@ void BCGetAppPropertiesRequest::Run() { const auto app_ids = policy_handler_.GetApplicationPolicyIDs(); int i = 0; for (auto& app_id : app_ids) { + smart_objects::SmartObject properties(smart_objects::SmartType_Map); FillAppProperties(app_id, properties); response_params[strings::properties][i++] = properties; } } - if (properties.empty()) { + if (response_params[strings::properties].empty()) { SendErrorResponse( (*message_)[strings::params][strings::correlation_id].asUInt(), hmi_apis::FunctionID::BasicCommunication_GetAppProperties, -- cgit v1.2.1