From dabcc4cc9b17f1ba32818108720d62195ad647da Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 24 Mar 2006 01:45:03 +0000 Subject: Check values loaded from theme INI and give meaningful errors instead of bad crashes on blitting stage. svn-id: r21422 --- gui/newgui.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gui/newgui.cpp') diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 67cffab6df..d1000a20d5 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -65,6 +65,19 @@ GuiObject::GuiObject(Common::String name) : _firstWidget(0) { _w = g_gui.evaluator()->getVar(name + ".w"); _h = g_gui.evaluator()->getVar(name + ".h"); + if(_x < 0) + error("Widget <%s> has x < 0", name.c_str()); + if(_x >= g_system->getOverlayWidth()) + error("Widget <%s> has x > %d", name.c_str(), g_system->getOverlayWidth()); + if(_x + _w >= g_system->getOverlayWidth()) + error("Widget <%s> has x + w > %d", name.c_str(), g_system->getOverlayWidth()); + if(_y < 0) + error("Widget <%s> has y < 0", name.c_str()); + if(_y >= g_system->getOverlayWidth()) + error("Widget <%s> has y > %d", name.c_str(), g_system->getOverlayHeight()); + if(_y + _h >= g_system->getOverlayWidth()) + error("Widget <%s> has y + h > %d", name.c_str(), g_system->getOverlayHeight()); + _name = name; } -- cgit v1.2.3