1
0
Fork 0
forked from len0rd/rockbox

Theme Editor: Renderer now correctly handles special case with only one branch in a conditional

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27609 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-07-29 06:41:33 +00:00
parent 85040111fe
commit b22077cd60

View file

@ -560,7 +560,9 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport,
else if(element->type == CONDITIONAL) else if(element->type == CONDITIONAL)
{ {
int child = evalTag(info, true, element->children_count).toInt(); int child = evalTag(info, true, element->children_count).toInt();
children[element->params_count + child]->render(info, viewport, true); if(child < children.count())
children[element->params_count + child]
->render(info, viewport, true);
} }
else if(element->type == LINE_ALTERNATOR) else if(element->type == LINE_ALTERNATOR)
{ {
@ -1016,6 +1018,8 @@ QVariant ParseTreeNode::evalTag(const RBRenderInfo& info, bool conditional,
if(child < branches) if(child < branches)
return child; return child;
else if(branches == 1)
return 2;
else else
return branches - 1; return branches - 1;
} }