summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-03-15 20:57:46 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-03-15 20:57:46 -0400
commit440df3425dcc2376755d622ad6fd965eb25a25c2 (patch)
tree97b8c75ca090998b6d56e8cb302b773871c46792 /src
parenteb61ec5578bf45d454d9d0c9fba523b7803a5ed9 (diff)
downloadtherapy-440df3425dcc2376755d622ad6fd965eb25a25c2.tar.gz
therapy-440df3425dcc2376755d622ad6fd965eb25a25c2.tar.bz2
therapy-440df3425dcc2376755d622ad6fd965eb25a25c2.zip
Fixed the empty XML bug AGAIN
Diffstat (limited to 'src')
-rw-r--r--src/map.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/map.cpp b/src/map.cpp index 36baab6..29f22ec 100644 --- a/src/map.cpp +++ b/src/map.cpp
@@ -43,7 +43,11 @@ Map::Map(const std::string name)
43 if (!xmlStrcmp(node->name, (const xmlChar*) "name")) 43 if (!xmlStrcmp(node->name, (const xmlChar*) "name"))
44 { 44 {
45 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); 45 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
46 title = (char*) key; 46 if (key != 0)
47 {
48 title = (char*) key;
49 }
50
47 xmlFree(key); 51 xmlFree(key);
48 } else if (!xmlStrcmp(node->name, (const xmlChar*) "environment")) 52 } else if (!xmlStrcmp(node->name, (const xmlChar*) "environment"))
49 { 53 {
@@ -67,7 +71,11 @@ Map::Map(const std::string name)
67 if (!xmlStrcmp(entityDataNode->name, (const xmlChar*) "entity-type")) 71 if (!xmlStrcmp(entityDataNode->name, (const xmlChar*) "entity-type"))
68 { 72 {
69 xmlChar* key = xmlNodeListGetString(doc, entityDataNode->xmlChildrenNode, 1); 73 xmlChar* key = xmlNodeListGetString(doc, entityDataNode->xmlChildrenNode, 1);
70 data.name = std::string((char*) key); 74 if (key != 0)
75 {
76 data.name = (char*) key;
77 }
78
71 xmlFree(key); 79 xmlFree(key);
72 } else if (!xmlStrcmp(entityDataNode->name, (const xmlChar*) "entity-position")) 80 } else if (!xmlStrcmp(entityDataNode->name, (const xmlChar*) "entity-position"))
73 { 81 {
@@ -83,23 +91,21 @@ Map::Map(const std::string name)
83 } else if (!xmlStrcmp(node->name, (const xmlChar*) "leftmap")) 91 } else if (!xmlStrcmp(node->name, (const xmlChar*) "leftmap"))
84 { 92 {
85 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); 93 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
86 std::string mapname = (char*) key; 94 if (key != 0)
87 xmlFree(key);
88
89 if (mapname.length() > 0)
90 { 95 {
91 leftMap = &Map::getNamedMap(mapname); 96 leftMap = &Map::getNamedMap((char*) key);
92 } 97 }
98
99 xmlFree(key);
93 } else if (!xmlStrcmp(node->name, (const xmlChar*) "rightmap")) 100 } else if (!xmlStrcmp(node->name, (const xmlChar*) "rightmap"))
94 { 101 {
95 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); 102 xmlChar* key = xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
96 std::string mapname = (char*) key; 103 if (key != 0)
97 xmlFree(key);
98
99 if (mapname.length() > 0)
100 { 104 {
101 rightMap = &Map::getNamedMap(mapname); 105 rightMap = &Map::getNamedMap((char*) key);
102 } 106 }
107
108 xmlFree(key);
103 } 109 }
104 } 110 }
105 111