summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-10-12 01:58:37 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2021-10-13 18:02:19 -0400
commit6fb942d8ff843444cbade57278de6e6687337fd6 (patch)
tree420eae42ace4750118acdf81d6712bd32dde380e /apps/gui/skin_engine
parente0468074fea65a023274417815a310e5e9017661 (diff)
downloadrockbox-6fb942d8ff843444cbade57278de6e6687337fd6.tar.gz
rockbox-6fb942d8ff843444cbade57278de6e6687337fd6.zip
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
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r--apps/gui/skin_engine/skin_parser.c2
-rw-r--r--apps/gui/skin_engine/skin_tokens.c3
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,
768#ifndef __PCTOOL__ 768#ifndef __PCTOOL__
769 i = lang_english_to_id(temp); 769 i = lang_english_to_id(temp);
770 if (i < 0) 770 if (i < 0)
771 return WPS_ERROR_INVALID_PARAM; 771 i = LANG_LAST_INDEX_IN_ARRAY;
772#endif 772#endif
773 } 773 }
774 else if (element->params_count > 1) 774 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,
821 return (char*)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data); 821 return (char*)SKINOFFSETTOPTR(get_skin_buffer(data), token->value.data);
822 822
823 case SKIN_TOKEN_TRANSLATEDSTRING: 823 case SKIN_TOKEN_TRANSLATEDSTRING:
824 return (char*)P2STR(ID2P(token->value.i)); 824 return token->value.i < LANG_LAST_INDEX_IN_ARRAY ?
825 (char*)P2STR(ID2P(token->value.i)) : "<ERR>";
825 826
826 case SKIN_TOKEN_PLAYLIST_ENTRIES: 827 case SKIN_TOKEN_PLAYLIST_ENTRIES:
827 numeric_ret = playlist_amount(); 828 numeric_ret = playlist_amount();