mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Better safety checks for Cocoa menu code, potential crash fix. b=532585 r=josh
This commit is contained in:
parent
742c8af65f
commit
8bf2995eda
@ -866,13 +866,11 @@ static pascal OSStatus MyMenuEventHandler(EventHandlerCallRef myHandler, EventRe
|
||||
|
||||
// don't request a menu item that doesn't exist or we crash
|
||||
// this might happen just due to some random quirks in the event system
|
||||
PRUint32 itemCount;
|
||||
targetMenu->GetVisibleItemCount(itemCount);
|
||||
if (aPos >= itemCount)
|
||||
nsMenuObjectX* target = targetMenu->GetVisibleItemAt((PRUint32)aPos);
|
||||
if (!target)
|
||||
return eventNotHandledErr;
|
||||
|
||||
// Send DOM event if we're over a menu item
|
||||
nsMenuObjectX* target = targetMenu->GetVisibleItemAt((PRUint32)aPos);
|
||||
if (target->MenuObjectType() == eMenuItemObjectType) {
|
||||
nsMenuItemX* targetMenuItem = static_cast<nsMenuItemX*>(target);
|
||||
PRBool handlerCalledPreventDefault; // but we don't actually care
|
||||
|
Loading…
Reference in New Issue
Block a user