mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
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
This commit is contained in:
parent
44ff54098e
commit
b783e916ab
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user