From 1399126d904df0961c268f618e1bd193ed50394b Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Fri, 8 Mar 2002 21:55:43 +0000 Subject: [PATCH] Don't assert & crash when trying to get child docshells that are out of bounds. b=127528 r=ccarlen@netscape.com sr=jst@netscape.com a=asa@mozilla.org --- docshell/base/nsDocShell.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 94e81366566f..ee24d545ff96 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2029,8 +2029,8 @@ nsDocShell::GetChildAt(PRInt32 aIndex, nsIDocShellTreeItem ** aChild) { NS_ENSURE_ARG_POINTER(aChild); - NS_ASSERTION(aIndex >= 0 && aIndex < mChildren.Count(),"Bad docshell ChildAt index"); - *aChild = (nsIDocShellTreeItem *) mChildren.ElementAt(aIndex); + NS_WARN_IF_FALSE(aIndex >=0 && aIndex < mChildren.Count(), "index of child element is out of range!"); + *aChild = (nsIDocShellTreeItem *) mChildren.SafeElementAt(aIndex); NS_IF_ADDREF(*aChild); return NS_OK;