mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-26 23:36:37 -04:00
Fix FS#11829 - %?xx<....> Crashes on targets where the %xx feature tag isnt avilable. rather hacky fix though better than crashing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28890 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
99732ca57b
commit
78a11cf648
1 changed files with 45 additions and 27 deletions
|
|
@ -969,37 +969,55 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
|
||||||
cursor = bookmark;
|
cursor = bookmark;
|
||||||
#endif
|
#endif
|
||||||
/* Parsing the children */
|
/* Parsing the children */
|
||||||
element->children = skin_alloc_children(children);
|
|
||||||
if (!element->children)
|
/* Feature tags could end up having 0 children which breaks
|
||||||
return 0;
|
* the render in dangerous ways. Minor hack, but insert an empty
|
||||||
element->children_count = children;
|
* child. (e.g %?xx<foo> when xx isnt available ) */
|
||||||
|
|
||||||
for(i = 0; i < children; i++)
|
if (children == 0)
|
||||||
{
|
{
|
||||||
element->children[i] = skin_parse_code_as_arg(&cursor);
|
const char* emptyline= "";
|
||||||
if (element->children[i] == NULL)
|
children = 1;
|
||||||
return 0;
|
element->children = skin_alloc_children(children);
|
||||||
skip_whitespace(&cursor);
|
if (!element->children)
|
||||||
|
return 0;
|
||||||
|
element->children_count = children;
|
||||||
|
element->children[0] = skin_parse_code_as_arg(&emptyline);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
element->children = skin_alloc_children(children);
|
||||||
|
if (!element->children)
|
||||||
|
return 0;
|
||||||
|
element->children_count = children;
|
||||||
|
|
||||||
|
for(i = 0; i < children; i++)
|
||||||
|
{
|
||||||
|
element->children[i] = skin_parse_code_as_arg(&cursor);
|
||||||
|
if (element->children[i] == NULL)
|
||||||
|
return 0;
|
||||||
|
skip_whitespace(&cursor);
|
||||||
#ifdef ROCKBOX
|
#ifdef ROCKBOX
|
||||||
if ((element->tag->flags&FEATURE_TAG) && feature_available)
|
if ((element->tag->flags&FEATURE_TAG) && feature_available)
|
||||||
cursor = conditional_end;
|
cursor = conditional_end;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(i < children - 1 && *cursor != ENUMLISTSEPARATESYM)
|
if(i < children - 1 && *cursor != ENUMLISTSEPARATESYM)
|
||||||
{
|
{
|
||||||
skin_error(SEPARATOR_EXPECTED, cursor);
|
skin_error(SEPARATOR_EXPECTED, cursor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(i == children - 1 && *cursor != ENUMLISTCLOSESYM)
|
else if(i == children - 1 && *cursor != ENUMLISTCLOSESYM)
|
||||||
{
|
{
|
||||||
skin_error(CLOSE_EXPECTED, cursor);
|
skin_error(CLOSE_EXPECTED, cursor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cursor++;
|
cursor++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*document = cursor;
|
*document = cursor;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue