* BUG: Getting an attribute that doesn't exist doesn't crashes anymore, it returns a null string instead.
* BUG: The string comparison mode argument is now correctly handled by XmlElement.GetAttribute().

git-svn-id: svn://localhost/gambas/trunk@4927 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Adrien Prokopowicz 2012-07-09 22:22:11 +00:00
parent a036882dcc
commit 159390bc46
2 changed files with 10 additions and 3 deletions

View file

@ -74,9 +74,9 @@ BEGIN_METHOD(CElement_appendChild, GB_OBJECT newChild)
END_METHOD
BEGIN_METHOD(CElement_getAttribute, GB_STRING attrName)
BEGIN_METHOD(CElement_getAttribute, GB_STRING attrName; GB_INTEGER mode)
Attribute *attr = THIS->getAttribute(STRING(attrName), LENGTH(attrName));
Attribute *attr = THIS->getAttribute(STRING(attrName), LENGTH(attrName), VARG(mode));
if(attr)
{
GB.ReturnNewString(attr->attrValue, attr->lenAttrValue);

View file

@ -199,7 +199,14 @@ if(!THIS->isElement()) return;
Attribute *attr = THIS->toElement()->getAttribute(STRING(name), LENGTH(name));
GB.ReturnNewString(attr->attrValue, attr->lenAttrValue);
if(attr)
{
GB.ReturnNewString(attr->attrValue, attr->lenAttrValue);
}
else
{
GB.ReturnNull();
}
END_METHOD