summaryrefslogtreecommitdiff
path: root/lib/skin_parser/skin_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/skin_parser/skin_parser.c')
-rw-r--r--lib/skin_parser/skin_parser.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index 64ac462c2c..f574d3f7a2 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -877,6 +877,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
877#ifdef ROCKBOX 877#ifdef ROCKBOX
878 bool feature_available = true; 878 bool feature_available = true;
879 const char *false_branch = NULL; 879 const char *false_branch = NULL;
880 const char *conditional_end = NULL;
880#endif 881#endif
881 882
882 /* Some conditional tags allow for target feature checking, 883 /* Some conditional tags allow for target feature checking,
@@ -955,6 +956,12 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
955 false_branch = cursor+1; 956 false_branch = cursor+1;
956 children--; 957 children--;
957 } 958 }
959 if (element->tag->flags&FEATURE_TAG)
960 {
961 if (feature_available)
962 children--;
963 }
964 conditional_end = cursor;
958 /* if we are skipping the true branch fix that up */ 965 /* if we are skipping the true branch fix that up */
959 cursor = false_branch ? false_branch : bookmark; 966 cursor = false_branch ? false_branch : bookmark;
960#else 967#else
@@ -969,7 +976,13 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
969 for(i = 0; i < children; i++) 976 for(i = 0; i < children; i++)
970 { 977 {
971 element->children[i] = skin_parse_code_as_arg(&cursor); 978 element->children[i] = skin_parse_code_as_arg(&cursor);
979 if (element->children[i] == NULL)
980 return 0;
972 skip_whitespace(&cursor); 981 skip_whitespace(&cursor);
982#ifdef ROCKBOX
983 if ((element->tag->flags&FEATURE_TAG) && feature_available)
984 cursor = conditional_end;
985#endif
973 986
974 if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM) 987 if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM)
975 { 988 {
@@ -986,7 +999,6 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
986 cursor++; 999 cursor++;
987 } 1000 }
988 } 1001 }
989
990 *document = cursor; 1002 *document = cursor;
991 1003
992 return 1; 1004 return 1;