summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShobhit Adlakha <ShobhitAd@users.noreply.github.com>2022-06-10 14:49:00 -0400
committerGitHub <noreply@github.com>2022-06-10 14:49:00 -0400
commitff52b89f23f2d91e67a0936168f278810263dc4d (patch)
tree3a3dc300c72afa2f206bf40cb6b35c983e0c28a6
parent2fa821028d2457a4e9d62381edb635769b8bf704 (diff)
downloadsdl_core-ff52b89f23f2d91e67a0936168f278810263dc4d.tar.gz
Fix/Reset VRHelp array to default values instead of null (#3916)
* Add changes in ResetVrHelpTitleItems to reset vrHelp to default values instead of null * Get correct vr help items from smartobject * Address review comments
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc12
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc11
2 files changed, 14 insertions, 9 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index ec37e3b51f..5066c6dfc6 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -3984,11 +3984,19 @@ bool ApplicationManagerImpl::ResetVrHelpTitleItems(
const std::string& vr_help_title = get_settings().vr_help_title();
smart_objects::SmartObject so_vr_help_title(vr_help_title);
-
app->reset_vr_help_title();
- app->reset_vr_help();
app->set_vr_help_title(so_vr_help_title);
+ app->reset_vr_help();
+ smart_objects::SmartObjectSPtr so_vr_help =
+ MessageHelper::CreateAppVrHelp(app);
+ if (!so_vr_help->keyExists(strings::vr_help)) {
+ SDL_LOG_WARN("Failed to create vr_help items. Resetting to empty array");
+ (*so_vr_help)[strings::vr_help] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ }
+ app->set_vr_help((*so_vr_help)[strings::vr_help]);
+
return true;
}
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 2e60bb2c66..f8960a26fc 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -383,13 +383,10 @@ MessageHelper::CreateUIResetGlobalPropertiesRequest(
smart_objects::SmartType_Map);
if (reset_result.vr_help_title_items) {
- smart_objects::SmartObjectSPtr vr_help = CreateAppVrHelp(application);
- if (!vr_help.get()) {
- SDL_LOG_WARN("Failed to create vr_help");
- return smart_objects::SmartObjectSPtr();
- } else {
- ui_reset_global_prop_request = vr_help;
- }
+ (*ui_reset_global_prop_request)[strings::vr_help_title] =
+ *(application->vr_help_title());
+ (*ui_reset_global_prop_request)[strings::vr_help] =
+ *(application->vr_help());
}
if (reset_result.menu_name) {
(*ui_reset_global_prop_request)[hmi_request::menu_title] = "";