Don't use uninitialized variables. Bug 414076 followup, patch by Ronny Perinke <ronny.perinke@gmx.de>, r+sr=bzbarsky
authorbzbarsky@mit.edu
Wed, 19 Mar 2008 16:23:59 -0700
changeset 13335 fe2896854ba5183e9feeb7213ac34eb0fb1f1c6e
parent 13334 26b934fed88de16afe852600cdb607cf39a13b0a
child 13336 14b5b8491ba3b9538ca85506f62dda04a9a0f393
push idunknown
push userunknown
push dateunknown
bugs414076
milestone1.9b5pre
Don't use uninitialized variables. Bug 414076 followup, patch by Ronny Perinke <ronny.perinke@gmx.de>, r+sr=bzbarsky
content/base/src/nsContentIterator.cpp
--- a/content/base/src/nsContentIterator.cpp
+++ b/content/base/src/nsContentIterator.cpp
@@ -1001,33 +1001,33 @@ nsContentIterator::PositionAt(nsIContent
   // Check to see if the node falls within the traversal range.
 
   nsIContent* firstNode = mFirst;
   nsIContent* lastNode = mLast;
   PRInt32 firstOffset=0, lastOffset=0;
 
   if (firstNode && lastNode)
   {
-    PRUint32 numChildren;
-
     if (mPre)
     {
       firstNode = ContentToParentOffset(mFirst, &firstOffset);
 
       if (lastNode->GetChildCount())
         lastOffset = 0;
       else
       {
         lastNode = ContentToParentOffset(mLast, &lastOffset);
         ++lastOffset;
       }
     }
     else
     {
-      if (firstNode->GetChildCount())
+      PRUint32 numChildren = firstNode->GetChildCount();
+
+      if (numChildren)
         firstOffset = numChildren;
       else
         firstNode = ContentToParentOffset(mFirst, &firstOffset);
 
       lastNode = ContentToParentOffset(mLast, &lastOffset);
       ++lastOffset;
     }
   }