From 9d4a55c53772ac787f6e4298a8f959912b04bf38 Mon Sep 17 00:00:00 2001 From: Anatoly Leshin Date: Mon, 21 Sep 2015 16:19:01 +0400 Subject: Fix crash when processing SystemRequest with QUERY_APPS Process tts_name as string, not as array. tts_name in QueryApps json file is "string" according to APPLINK-11731, tts_name in UpdateApplist is "array of strings" according to API.xml Fix: APPLINK-15783 --- .../src/application_manager_impl.cc | 34 +++++++++++----------- .../application_manager/src/message_helper.cc | 7 ++--- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index fbe5228a1..33f334f0f 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -2005,28 +2005,28 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, continue; } + // AppId = 0 because this is query_app(provided by hmi for download, but not yet registered) ApplicationSharedPtr app( new ApplicationImpl(0, mobile_app_id, appName, PolicyHandler::instance()->GetStatisticManager())); - if (app) { - app->SetShemaUrl(url_scheme); - app->SetPackageName(package_name); - app->set_app_icon_path(full_icon_path); - app->set_hmi_application_id(hmi_app_id); - app->set_device(device_id); - - app->set_vr_synonyms(vrSynonym); - app->set_tts_name(ttsName); - - sync_primitives::AutoLock lock(apps_to_register_list_lock_); - LOG4CXX_DEBUG(logger_, "apps_to_register_ size before: " - << apps_to_register_.size()); - apps_to_register_.insert(app); - LOG4CXX_DEBUG(logger_, "apps_to_register_ size after: " - << apps_to_register_.size()); - } + DCHECK_OR_RETURN_VOID(app); + app->SetShemaUrl(url_scheme); + app->SetPackageName(package_name); + app->set_app_icon_path(full_icon_path); + app->set_hmi_application_id(hmi_app_id); + app->set_device(device_id); + + app->set_vr_synonyms(vrSynonym); + app->set_tts_name(ttsName); + + sync_primitives::AutoLock lock(apps_to_register_list_lock_); + LOG4CXX_DEBUG(logger_, "apps_to_register_ size before: " + << apps_to_register_.size()); + apps_to_register_.insert(app); + LOG4CXX_DEBUG(logger_, "apps_to_register_ size after: " + << apps_to_register_.size()); } } diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index 2fd6d9f74..87afde8b4 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -1299,11 +1299,8 @@ bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app, DCHECK_OR_RETURN(app_tts_name, false); if (!app_tts_name->empty()) { SmartObject output_tts_name = SmartObject(SmartType_Array); - - for (uint32_t i = 0; i < app_tts_name->length(); ++i) { - output_tts_name[i][strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; - output_tts_name[i][strings::text] = (*app_tts_name)[i]; - } + output_tts_name[0][strings::text] = *(app->tts_name()); + output_tts_name[0][strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; output[json::ttsName] = output_tts_name; } if (!app->vr_synonyms()->empty()) { -- cgit v1.2.1