File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,17 @@ std::unique_ptr<SXMLString> CXMLImpl::ParseString(const char* strXmlContent)
50
50
if (!xmlDoc->Error ())
51
51
{
52
52
TiXmlElement* xmlDocumentRoot = xmlDoc->RootElement ();
53
- CXMLNodeImpl* xmlBaseNode = new CXMLNodeImpl (nullptr , nullptr , *xmlDocumentRoot);
54
- xmlBaseNode->BuildFromDocument ();
55
- return std::unique_ptr<SXMLString>(new SXMLStringImpl (xmlDoc, xmlBaseNode));
53
+
54
+ if (xmlDocumentRoot)
55
+ {
56
+ CXMLNodeImpl* xmlBaseNode = new CXMLNodeImpl (nullptr , nullptr , *xmlDocumentRoot);
57
+
58
+ if (xmlBaseNode && xmlBaseNode->IsValid ())
59
+ {
60
+ xmlBaseNode->BuildFromDocument ();
61
+ return std::unique_ptr<SXMLString>(new SXMLStringImpl (xmlDoc, xmlBaseNode));
62
+ }
63
+ }
56
64
}
57
65
}
58
66
return nullptr ;
You can’t perform that action at this time.
0 commit comments