protect against exception being thrown when trying to remove a native menu item from a menu it isn't in. b=420640 r=smichaud sr=roc

git-svn-id: svn://10.0.0.236/trunk@246983 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
joshmoz%gmail.com 2008-03-04 08:11:29 +00:00
parent e63ef3049f
commit daf130da28

View File

@ -1046,7 +1046,10 @@ nsMenuX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aContent, n
menuParent->GetNativeData(&clientData);
if (clientData) {
NSMenu* parentMenu = reinterpret_cast<NSMenu*>(clientData);
[parentMenu removeItem:mNativeMenuItem];
// An exception will get thrown if we try to remove an item that isn't
// in the menu.
if ([parentMenu indexOfItem:mNativeMenuItem] != -1)
[parentMenu removeItem:mNativeMenuItem];
mVisible = PR_FALSE;
}
}