You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Jeff Lewis <jd...@xactware.com> on 2000/06/14 17:35:52 UTC

Bug Report - ElementImpl::getAttribute()

This function needs to check if attributes is null prior to dereferencing :

DOMString ElementImpl::getAttribute(const DOMString &nam)
{
    static DOMString *emptyString = 0;
    AttrImpl * attr=null;

    // Verify that there are attributes in this element
    if (attributes != null)
		(AttrImpl *)(attributes->getNamedItem(nam));

    return (attr==null) ? DStringPool::getStaticString("", &emptyString) :
attr->getValue();
};


Thanks

Re: Bug Report - ElementImpl::getAttribute()

Posted by Joe Polastre <po...@jtcsv.com>.
Bug Report - ElementImpl::getAttribute()Jeff,

  You're absolutely right. There are a few other places in ElementImpl that
need to check if attributes is null.  I will fix these and get them
submitted back to CVS.  Thanks,

-Joe Polastre
IBM Cupertino, XML Technology Group


----- Original Message -----
From: Jeff Lewis
To: 'xerces-c-dev@xml.apache.org'
Sent: Wednesday, June 14, 2000 8:35 AM
Subject: Bug Report - ElementImpl::getAttribute()


This function needs to check if attributes is null prior to dereferencing :
DOMString ElementImpl::getAttribute(const DOMString &nam)
{ 
    static DOMString *emptyString = 0; 
    AttrImpl * attr=null; 
    // Verify that there are attributes in this element 
    if (attributes != null) 
                (AttrImpl *)(attributes->getNamedItem(nam)); 
    return (attr==null) ? DStringPool::getStaticString("", &emptyString) : attr->getValue(); 
}; 


Thanks