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 "<ERR>"

Change-Id: I0d744cd48bb5a27e735fce3f6f740450d1f6a55a
This commit is contained in:
William Wilgus 2021-10-12 01:58:37 -04:00 committed by William Wilgus
parent e0468074fe
commit 6fb942d8ff
2 changed files with 3 additions and 2 deletions

View file

@ -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)

View file

@ -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)) : "<ERR>";
case SKIN_TOKEN_PLAYLIST_ENTRIES:
numeric_ret = playlist_amount();