From 6fb942d8ff843444cbade57278de6e6687337fd6 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Tue, 12 Oct 2021 01:58:37 -0400 Subject: [PATCH] skin engine - fail gracefully when %Sx is used on non lang id string CheckWPS doesn't catch errors involving translated strings Instead of breaking old themes when the langids no long exist return "" Change-Id: I0d744cd48bb5a27e735fce3f6f740450d1f6a55a --- apps/gui/skin_engine/skin_parser.c | 2 +- apps/gui/skin_engine/skin_tokens.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index a1cc40ff6e..4ebdcab722 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -768,7 +768,7 @@ static int parse_setting_and_lang(struct skin_element *element, #ifndef __PCTOOL__ i = lang_english_to_id(temp); if (i < 0) - return WPS_ERROR_INVALID_PARAM; + i = LANG_LAST_INDEX_IN_ARRAY; #endif } else if (element->params_count > 1) diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index a0de45d3e3..a4c9af7539 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -821,7 +821,8 @@ const char *get_token_value(struct gui_wps *gwps, return (char*)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data); case SKIN_TOKEN_TRANSLATEDSTRING: - return (char*)P2STR(ID2P(token->value.i)); + return token->value.i < LANG_LAST_INDEX_IN_ARRAY ? + (char*)P2STR(ID2P(token->value.i)) : ""; case SKIN_TOKEN_PLAYLIST_ENTRIES: numeric_ret = playlist_amount();