Browse Source

Merge pull request #113 from jaeggerr/development

SimXMLDocument GetData() will crash if it encounters an empty XML elemen...
Mike Lilligreen 12 years ago
parent
commit
a101ef0269
1 changed files with 6 additions and 1 deletions
  1. 6 1
      engine/source/persistence/SimXMLDocument.cpp

+ 6 - 1
engine/source/persistence/SimXMLDocument.cpp

@@ -1095,7 +1095,12 @@ const char* SimXMLDocument::getData()
    if(!pNode)
       return "";
 
-   TiXmlText* text = pNode->FirstChild()->ToText();
+   TiXmlNode * firstChild =  pNode->FirstChild();
+
+   if(!firstChild)
+	   return "";
+
+   TiXmlText* text = firstChild->ToText();
    if( !text )
       return "";