summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resources/mapreader.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 4da901b09..6d7591d1d 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -202,6 +202,7 @@ void MapReader::addLayerToList(const std::string &fileName)
return;
}
+ int cnt = 0;
for_each_xml_child_node(childNode, node)
{
if (!xmlNameEqual(childNode, "layer"))
@@ -213,8 +214,10 @@ void MapReader::addLayerToList(const std::string &fileName)
logger->log("found patch layer: " + name);
mKnownLayers[name] = childNode;
mKnownDocs.insert(doc);
+ cnt ++;
}
- delete doc;
+ if (!cnt)
+ delete doc;
}
Map *MapReader::readMap(const std::string &restrict filename,