- a little bit of code hardening (looking for invalid data conditions and NULL's)
This commit is contained in:
parent
a9534e727e
commit
8bf83c03a8
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user