diff --git a/gb.xml/src/CElement.cpp b/gb.xml/src/CElement.cpp index cb2b71fcf..384ab74fd 100644 --- a/gb.xml/src/CElement.cpp +++ b/gb.xml/src/CElement.cpp @@ -100,14 +100,15 @@ END_METHOD BEGIN_METHOD(CElement_getAttribute, GB_STRING attrName; GB_INTEGER mode) Attribute *attr = XMLElement_GetAttribute(THIS, STRING(attrName), LENGTH(attrName), VARG(mode)); - if(attr) - { - GB.ReturnNewString(attr->attrValue, attr->lenAttrValue); - } - else - { - GB.ReturnNull(); - } + +if(attr && attr->attrValue && attr->lenAttrValue) +{ + GB.ReturnNewString(attr->attrValue, attr->lenAttrValue); +} +else +{ + GB.ReturnNull(); +} END_METHOD diff --git a/gb.xml/src/CNode.cpp b/gb.xml/src/CNode.cpp index c3b367f5d..2bd74c169 100644 --- a/gb.xml/src/CNode.cpp +++ b/gb.xml/src/CNode.cpp @@ -205,9 +205,9 @@ if(THIS->type != Node::ElementNode) return; Attribute *attr = XMLElement_GetAttribute((Element*)THIS, STRING(name), LENGTH(name)); -if(attr) +if(attr && attr->attrValue && attr->lenAttrValue) { - GB.ReturnNewString(attr->attrValue ? : "", attr->lenAttrValue); + GB.ReturnNewString(attr->attrValue, attr->lenAttrValue); } else {