diff options
2 files changed, 14 insertions, 4 deletions
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h index 312302d157..ffb9359f9c 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h @@ -129,8 +129,9 @@ class ResumptionDataProcessorImpl * requests * @param app_id ID of application, related to event * @param found_request reference to found request + * @return true, if request is found and erased */ - void EraseProcessedRequest(const uint32_t app_id, + bool EraseProcessedRequest(const uint32_t app_id, const ResumptionRequest& found_request); /** diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc index b8462a533a..7d65ce75c2 100644 --- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc +++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc @@ -178,7 +178,7 @@ void ResumptionDataProcessorImpl::ProcessResumptionStatus( } } -void ResumptionDataProcessorImpl::EraseProcessedRequest( +bool ResumptionDataProcessorImpl::EraseProcessedRequest( const uint32_t app_id, const ResumptionRequest& found_request) { SDL_LOG_AUTO_TRACE(); @@ -194,7 +194,11 @@ void ResumptionDataProcessorImpl::EraseProcessedRequest( request.request_id.function_id == found_request.request_id.function_id; }); - list_of_sent_requests.erase(request_iter); + if (request_iter != list_of_sent_requests.end()) { + list_of_sent_requests.erase(request_iter); + return true; + } + return false; } bool ResumptionDataProcessorImpl::IsResumptionFinished( @@ -285,6 +289,7 @@ void ResumptionDataProcessorImpl::ProcessResponseFromHMI( SDL_LOG_DEBUG("app_id is: " << app_id); auto found_request = GetRequest(app_id, function_id, corr_id); + if (!found_request) { SDL_LOG_ERROR("Request with function id " << function_id << " and corr id " << corr_id << " not found"); @@ -293,7 +298,11 @@ void ResumptionDataProcessorImpl::ProcessResponseFromHMI( auto request = *found_request; ProcessResumptionStatus(app_id, response, request); - EraseProcessedRequest(app_id, request); + + if (!EraseProcessedRequest(app_id, request)) { + SDL_LOG_DEBUG("Request has already been processed"); + return; + } if (!IsResumptionFinished(app_id)) { SDL_LOG_DEBUG("Resumption app " |