- a little bit of code hardening (looking for invalid data conditions and NULL's)

This commit is contained in:
Mark Vejvoda 2011-01-10 21:23:52 +00:00
parent a9534e727e
commit 8bf83c03a8

View File

@ -187,7 +187,7 @@ XmlNode::XmlNode(DOMNode *node){
}
//get name
char str[strSize];
char str[strSize]="";
XMLString::transcode(node->getNodeName(), str, strSize-1);
name= str;
@ -197,13 +197,15 @@ XmlNode::XmlNode(DOMNode *node){
}
//check children
if(node->getChildNodes() != NULL) {
for(unsigned int i = 0; i < node->getChildNodes()->getLength(); ++i) {
DOMNode *currentNode= node->getChildNodes()->item(i);
if(currentNode->getNodeType()==DOMNode::ELEMENT_NODE){
if(currentNode != NULL && currentNode->getNodeType()==DOMNode::ELEMENT_NODE){
XmlNode *xmlNode= new XmlNode(currentNode);
children.push_back(xmlNode);
}
}
}
//check attributes
DOMNamedNodeMap *domAttributes= node->getAttributes();