Fixed: Parser crash when adding an XML layout with an unhandled type.

svn-id: r34801
This commit is contained in:
Vicent Marti 2008-10-14 17:29:48 +00:00
parent b3625cae2f
commit 820a45d851
2 changed files with 6 additions and 1 deletions

View file

@ -152,6 +152,8 @@ void ThemeEval::addLayout(ThemeLayout::LayoutType type, int spacing, bool center
else if (type == ThemeLayout::kLayoutHorizontal) else if (type == ThemeLayout::kLayoutHorizontal)
layout = new ThemeLayoutHorizontal(_curLayout.top(), spacing, center); layout = new ThemeLayoutHorizontal(_curLayout.top(), spacing, center);
assert(layout);
layout->setPadding( layout->setPadding(
getVar("Globals.Padding.Left", 0), getVar("Globals.Padding.Left", 0),
getVar("Globals.Padding.Right", 0), getVar("Globals.Padding.Right", 0),

View file

@ -605,6 +605,9 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) {
else if (node->values["type"] == "horizontal") else if (node->values["type"] == "horizontal")
_theme->getEvaluator()->addLayout(GUI::ThemeLayout::kLayoutHorizontal, spacing, node->values["center"] == "true"); _theme->getEvaluator()->addLayout(GUI::ThemeLayout::kLayoutHorizontal, spacing, node->values["center"] == "true");
else
return parserError("Invalid layout type. Only 'horizontal' and 'vertical' layouts allowed.");
if (node->values.contains("padding")) { if (node->values.contains("padding")) {
int paddingL, paddingR, paddingT, paddingB; int paddingL, paddingR, paddingT, paddingB;