From 9a502dcf07763ee4a9be76237010ed448eec6841 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Tue, 8 Sep 1998 22:32:32 +0000 Subject: [PATCH] Fixed bug caused during XPCOM'ing the nsIContent API --- content/base/src/nsDocument.cpp | 9 ++++++--- layout/base/src/nsDocument.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 1e7b9dfcb3c7..70ce1255b420 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1545,9 +1545,12 @@ nsIContent* nsDocument::GetNextContent(const nsIContent *aContent) const if (index+1 < count) { parent->ChildAt(index+1, result); // Get first child down the tree - PRInt32 n; - result->ChildCount(n); - while (n > 0) { + for (;;) { + PRInt32 n; + result->ChildCount(n); + if (n <= 0) { + break; + } nsIContent * old = result; old->ChildAt(0, result); NS_RELEASE(old); diff --git a/layout/base/src/nsDocument.cpp b/layout/base/src/nsDocument.cpp index 1e7b9dfcb3c7..70ce1255b420 100644 --- a/layout/base/src/nsDocument.cpp +++ b/layout/base/src/nsDocument.cpp @@ -1545,9 +1545,12 @@ nsIContent* nsDocument::GetNextContent(const nsIContent *aContent) const if (index+1 < count) { parent->ChildAt(index+1, result); // Get first child down the tree - PRInt32 n; - result->ChildCount(n); - while (n > 0) { + for (;;) { + PRInt32 n; + result->ChildCount(n); + if (n <= 0) { + break; + } nsIContent * old = result; old->ChildAt(0, result); NS_RELEASE(old);