aboutsummaryrefslogtreecommitdiff
path: root/backends/vkeybd
diff options
context:
space:
mode:
authorJohannes Schickel2012-01-03 01:49:45 +0100
committerJohannes Schickel2012-01-03 02:13:26 +0100
commit24d99038e44cb8ab7bf15dc3517a3deeecac0568 (patch)
tree1288ab62cfcc8015f31141b1868530afee0a6338 /backends/vkeybd
parentd0ddd299a4f19463749922859d2b5e9e5123b15f (diff)
downloadscummvm-rg350-24d99038e44cb8ab7bf15dc3517a3deeecac0568.tar.gz
scummvm-rg350-24d99038e44cb8ab7bf15dc3517a3deeecac0568.tar.bz2
scummvm-rg350-24d99038e44cb8ab7bf15dc3517a3deeecac0568.zip
VKEYBD: Properly error out parsing if an area is defined again.
Formerly the code did never check whether ImageMap::createArea returned a valid pointer and always just assumed so.
Diffstat (limited to 'backends/vkeybd')
-rw-r--r--backends/vkeybd/virtual-keyboard-parser.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp
index bbac503ff9..1958113578 100644
--- a/backends/vkeybd/virtual-keyboard-parser.cpp
+++ b/backends/vkeybd/virtual-keyboard-parser.cpp
@@ -313,10 +313,16 @@ bool VirtualKeyboardParser::parserCallback_area(ParserNode *node) {
return parseRect(_mode->displayArea, coords);
} else if (shape.equalsIgnoreCase("rect")) {
Polygon *poly = _mode->imageMap.createArea(target);
- return parseRectAsPolygon(*poly, coords);
+ if (!poly)
+ return parserError(Common::String::format("Cannot define area '%s' again", target.c_str()));
+ else
+ return parseRectAsPolygon(*poly, coords);
} else if (shape.equalsIgnoreCase("poly")) {
Polygon *poly = _mode->imageMap.createArea(target);
- return parsePolygon(*poly, coords);
+ if (!poly)
+ return parserError(Common::String::format("Cannot define area '%s' again", target.c_str()));
+ else
+ return parsePolygon(*poly, coords);
}
return parserError("Area shape '" + shape + "' not known");
}