mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 21:58:41 +02:00
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
This commit is contained in:
parent
83e6cf434d
commit
1399126d90
1 changed files with 2 additions and 2 deletions
|
|
@ -2029,8 +2029,8 @@ nsDocShell::GetChildAt(PRInt32 aIndex, nsIDocShellTreeItem ** aChild)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aChild);
|
NS_ENSURE_ARG_POINTER(aChild);
|
||||||
|
|
||||||
NS_ASSERTION(aIndex >= 0 && aIndex < mChildren.Count(),"Bad docshell ChildAt index");
|
NS_WARN_IF_FALSE(aIndex >=0 && aIndex < mChildren.Count(), "index of child element is out of range!");
|
||||||
*aChild = (nsIDocShellTreeItem *) mChildren.ElementAt(aIndex);
|
*aChild = (nsIDocShellTreeItem *) mChildren.SafeElementAt(aIndex);
|
||||||
NS_IF_ADDREF(*aChild);
|
NS_IF_ADDREF(*aChild);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue