diff options
author | JackLivio <jack@livio.io> | 2019-07-22 13:28:13 -0400 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2019-07-22 13:28:13 -0400 |
commit | 61cf66892d1cd732aefd0aea881c9b647bd117b6 (patch) | |
tree | a41a61b03f1da353bc73a6c5289469db230c9ef2 | |
parent | 9aabcc98501a226ce95b8ceb9c9d70917dc64325 (diff) | |
download | sdl_core-61cf66892d1cd732aefd0aea881c9b647bd117b6.tar.gz |
Address comments
3 files changed, 13 insertions, 11 deletions
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc index 8e117fcc70..30905b5fa2 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc @@ -62,11 +62,11 @@ void ASUnpublishAppServiceRequest::Run() { auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); - if (service->mobile_service) { + if (!service || service->mobile_service) { SendErrorResponse( (*message_)[strings::params][strings::correlation_id].asUInt(), hmi_apis::FunctionID::AppService_UnpublishAppService, - hmi_apis::Common_Result::REJECTED, + hmi_apis::Common_Result::INVALID_ID, "Invalid Service ID", application_manager::commands::Command::SOURCE_SDL_TO_HMI); return; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc index 1bdfd4d8e1..17af1717fa 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc @@ -64,7 +64,7 @@ void UnpublishAppServiceRequest::Run() { auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); - if (service->connection_key != connection_key()) { + if (!service || service->connection_key != connection_key()) { SendResponse( false, mobile_apis::Result::INVALID_ID, diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc index dff44f71b4..a85921a8cd 100644 --- a/src/components/application_manager/src/app_service_manager.cc +++ b/src/components/application_manager/src/app_service_manager.cc @@ -80,14 +80,16 @@ smart_objects::SmartObject AppServiceManager::PublishAppService( if (manifest.keyExists(strings::service_name)) { auto service_by_name = FindServiceByName(manifest[strings::service_name].asString()); - auto service_by_name_id = - service_by_name->record[strings::service_id].asString(); - auto found_service_id = - found_service->record[strings::service_id].asString(); - if (service_by_name_id != found_service_id) { - LOG4CXX_WARN(logger_, - "A service already exists with this name, rejecting"); - return smart_objects::SmartObject(); + if (service_by_name) { + auto service_by_name_id = + service_by_name->record[strings::service_id].asString(); + auto found_service_id = + found_service->record[strings::service_id].asString(); + if (service_by_name_id != found_service_id) { + LOG4CXX_WARN(logger_, + "A service already exists with this name, rejecting"); + return smart_objects::SmartObject(); + } } } LOG4CXX_WARN(logger_, "Service already exists for this provider, updating"); |