Bug 116413: Use SafeElementAt for Mac nsMenuStack::GetMenuAt/HaveMenuAt.

sr=jst, no r= needed as per jst
This commit is contained in:
rjesup%wgate.com 2001-12-22 01:20:26 +00:00
parent d579c42217
commit 0f238b249b

View File

@ -100,7 +100,8 @@ nsMenuStack::~nsMenuStack()
nsresult
nsMenuStack::GetMenuAt(PRInt32 aIndex, nsIMenu **outMenu)
{
nsCOMPtr<nsISupports> elementPtr = getter_AddRefs(mMenuArray.ElementAt(aIndex));
// I'd prefer to fix the caller, but this will be safe
nsCOMPtr<nsISupports> elementPtr = getter_AddRefs(mMenuArray.SafeElementAt(aIndex));
if (!elementPtr)
return NS_ERROR_NULL_POINTER;
@ -111,7 +112,8 @@ nsMenuStack::GetMenuAt(PRInt32 aIndex, nsIMenu **outMenu)
PRBool
nsMenuStack::HaveMenuAt(PRInt32 aIndex)
{
nsCOMPtr<nsISupports> elementPtr = getter_AddRefs(mMenuArray.ElementAt(aIndex));
// I'd prefer to fix the caller, but this will be safe
nsCOMPtr<nsISupports> elementPtr = getter_AddRefs(mMenuArray.SafeElementAt(aIndex));
if (!elementPtr)
return NS_ERROR_NULL_POINTER;