From b7d2d2da5eba0d55100df840f801be3668614dca Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Thu, 18 Aug 2005 11:16:02 +0000 Subject: [PATCH] Fix for bug # 76472 Assertion in GetChildAt() r=valeski sr=rpotts git-svn-id: svn://10.0.0.236/trunk@178084 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/shistory/src/nsSHistory.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mozilla/docshell/shistory/src/nsSHistory.cpp b/mozilla/docshell/shistory/src/nsSHistory.cpp index 05339476c8f..1574c76193f 100644 --- a/mozilla/docshell/shistory/src/nsSHistory.cpp +++ b/mozilla/docshell/shistory/src/nsSHistory.cpp @@ -716,24 +716,25 @@ nsSHistory::CompareSHEntry(nsISHEntry * aPrevEntry, nsISHEntry * aNextEntry, nsI if (!prevContainer || !nextContainer) return PR_FALSE; - prevContainer->GetChildCount(&pcnt); - nextContainer->GetChildCount(&ncnt); - dsTreeNode->GetChildCount(&dsCount); + prevContainer->GetChildCount(&pcnt); + nextContainer->GetChildCount(&ncnt); + dsTreeNode->GetChildCount(&dsCount); - //XXX What to do if the children count don't match + //XXX What to do if the children count don't match - for (PRInt32 i=0; i pChild, nChild; - nsCOMPtr dsTreeItemChild; + nsCOMPtr dsTreeItemChild; - prevContainer->GetChildAt(i, getter_AddRefs(pChild)); + prevContainer->GetChildAt(i, getter_AddRefs(pChild)); nextContainer->GetChildAt(i, getter_AddRefs(nChild)); - dsTreeNode->GetChildAt(i, getter_AddRefs(dsTreeItemChild)); + if (dsCount > 0) + dsTreeNode->GetChildAt(i, getter_AddRefs(dsTreeItemChild)); if (!dsTreeItemChild) return PR_FALSE; - nsCOMPtr dsChild(do_QueryInterface(dsTreeItemChild)); + nsCOMPtr dsChild(do_QueryInterface(dsTreeItemChild)); result = CompareSHEntry(pChild, nChild, dsChild, aDSResult, aSHEResult); if (result) // We have found the docshell in which loadUri is to be called.