diff options
author | Vicent Marti | 2008-10-14 17:29:48 +0000 |
---|---|---|
committer | Vicent Marti | 2008-10-14 17:29:48 +0000 |
commit | 820a45d8514be835daf204f54472cbb884fa0ac9 (patch) | |
tree | df3248ad780620c2a1bbaf342bc9e42a12923e81 /gui | |
parent | b3625cae2fa2cc74ab69adcd29bfe7f3ede4b19b (diff) | |
download | scummvm-rg350-820a45d8514be835daf204f54472cbb884fa0ac9.tar.gz scummvm-rg350-820a45d8514be835daf204f54472cbb884fa0ac9.tar.bz2 scummvm-rg350-820a45d8514be835daf204f54472cbb884fa0ac9.zip |
Fixed: Parser crash when adding an XML layout with an unhandled type.
svn-id: r34801
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeEval.cpp | 2 | ||||
-rw-r--r-- | gui/ThemeParser.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp index 40b671c8c3..4437809599 100644 --- a/gui/ThemeEval.cpp +++ b/gui/ThemeEval.cpp @@ -151,6 +151,8 @@ void ThemeEval::addLayout(ThemeLayout::LayoutType type, int spacing, bool center layout = new ThemeLayoutVertical(_curLayout.top(), spacing, center); else if (type == ThemeLayout::kLayoutHorizontal) layout = new ThemeLayoutHorizontal(_curLayout.top(), spacing, center); + + assert(layout); layout->setPadding( getVar("Globals.Padding.Left", 0), diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index 07eb56f781..627e7dc210 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -605,7 +605,10 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) { else if (node->values["type"] == "horizontal") _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")) { int paddingL, paddingR, paddingT, paddingB; |