From eff86f7772737c8bf7623a7e8ed9c702e27aa339 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 --- docshell/shistory/src/nsSHistory.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index 05339476c8f..1574c76193f 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/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.