summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-02 21:17:53 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-02 21:17:53 +0300
commitbfa44d6b007ca2e3ffabafda5beadbf102a6efdc (patch)
tree8f5d51f3ac6486f42aa531032209a0dddcc6e45d /src/resources/mapreader.cpp
parent181ecd0c3bf27b47487f973fb83b988fd6ceaecf (diff)
downloadplus-bfa44d6b007ca2e3ffabafda5beadbf102a6efdc.tar.gz
plus-bfa44d6b007ca2e3ffabafda5beadbf102a6efdc.tar.bz2
plus-bfa44d6b007ca2e3ffabafda5beadbf102a6efdc.tar.xz
plus-bfa44d6b007ca2e3ffabafda5beadbf102a6efdc.zip
Other fixes from Coverity checks.
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index ec7651745..98de2cd49 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -242,10 +242,11 @@ Map *MapReader::readMap(const std::string &filename,
{
map->setProperty("_filename", realFilename);
map->setProperty("_realfilename", filename);
+
+ if (map->getProperty("music").empty())
+ updateMusic(map);
}
- if (map->getProperty("music").empty())
- updateMusic(map);
return map;
}
@@ -716,7 +717,10 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path,
doc = new XML::Document(filename);
node = doc->rootNode();
if (!node)
+ {
+ delete doc;
return nullptr;
+ }
// Reset path to be realtive to the tsx file
pathDir = filename.substr(0, filename.rfind("/") + 1);
@@ -729,6 +733,10 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path,
{
if (xmlNameEqual(childNode, "image"))
{
+ // ignore second other <image> tags in tileset
+ if (set)
+ continue;
+
const std::string source = XML::getProperty(
childNode, "source", "");