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:
Jonathan Gordon 2010-12-24 07:58:26 +00:00
parent 99732ca57b
commit 78a11cf648

View file

@ -969,6 +969,23 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
cursor = bookmark;
#endif
/* Parsing the children */
/* Feature tags could end up having 0 children which breaks
* the render in dangerous ways. Minor hack, but insert an empty
* child. (e.g %?xx<foo> when xx isnt available ) */
if (children == 0)
{
const char* emptyline= "";
children = 1;
element->children = skin_alloc_children(children);
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;
@ -1000,6 +1017,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
cursor++;
}
}
}
*document = cursor;
return 1;