0023326: The 'aSibling' pointer was utilized before it was verified against nullptr...
authorPawel <pawel-kowalski@wp.pl>
Wed, 18 Jul 2012 12:50:45 +0000 (14:50 +0200)
committerPawel Kowalski <pawel-kowalski@wp.pl>
Fri, 27 Jul 2012 11:14:35 +0000 (15:14 +0400)
Verifying pointer against NULL before accessing it.

src/LDOM/LDOM_Element.cxx

index edc90c8..2682de3 100755 (executable)
@@ -79,12 +79,12 @@ LDOM_Attr LDOM_Element::getAttributeNode (const LDOMString& aName) const
     if (aNode && aNode -> getNodeType () != LDOM_Node::ATTRIBUTE_NODE)
       while (1) {
         const LDOM_BasicNode * aSibling = aNode -> GetSibling();
+        if (aSibling == NULL)
+          return LDOM_Attr ();
         if (aSibling -> getNodeType () == LDOM_Node::ATTRIBUTE_NODE) {
           (const LDOM_BasicNode *&) myLastChild = aSibling;
           break;
         }
-        if (aSibling == NULL)
-          return LDOM_Attr ();
         aNode = aSibling;
       }
   }