summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-03-15 17:06:52 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-03-15 17:06:52 -0400
commit3d24adb1162c4ce1b5030b73ea72873a2b14f6f9 (patch)
treebf4aa55a898ed2a4f0562b06e3b3cd69fdd8f85a /src
parent168b51517682b8d82fdbd6432af7511bb493c85f (diff)
downloadtherapy-3d24adb1162c4ce1b5030b73ea72873a2b14f6f9.tar.gz
therapy-3d24adb1162c4ce1b5030b73ea72873a2b14f6f9.tar.bz2
therapy-3d24adb1162c4ce1b5030b73ea72873a2b14f6f9.zip
Fixed bug with map with no name
Diffstat (limited to 'src')
-rw-r--r--src/map.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp index 6b83442..ef0d6c3 100644 --- a/src/map.cpp +++ b/src/map.cpp
@@ -44,8 +44,14 @@ Map::Map(const std::string name)
44 if (!xmlStrcmp(node->name, (const xmlChar*) "name")) 44 if (!xmlStrcmp(node->name, (const xmlChar*) "name"))
45 { 45 {
46 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); 46 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
47 title = (char*) calloc(xmlStrlen(key) + 1, sizeof(char)); 47 int len = xmlStrlen(key);
48 strcpy(title, (char*) key); 48 title = (char*) calloc(len + 1, sizeof(char));
49
50 if (len > 0)
51 {
52 strcpy(title, (char*) key);
53 }
54
49 xmlFree(key); 55 xmlFree(key);
50 } else if (!xmlStrcmp(node->name, (const xmlChar*) "environment")) 56 } else if (!xmlStrcmp(node->name, (const xmlChar*) "environment"))
51 { 57 {