Bug 1178984 - Crashes at nsMenuBarX::RemoveMenuAtIndex. r=spohl

This commit is contained in:
Steven Michaud 2015-07-01 14:28:05 -05:00
parent 27cd1411d2
commit e65466be3c

View File

@ -241,7 +241,10 @@ void nsMenuBarX::RemoveMenuAtIndex(uint32_t aIndex)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
NS_ASSERTION(aIndex < mMenuArray.Length(), "Attempting submenu removal with bad index!");
if (mMenuArray.Length() <= aIndex) {
NS_ERROR("Attempting submenu removal with bad index!");
return;
}
// Our native menu and our internal menu object array might be out of sync.
// This happens, for example, when a submenu is hidden. Because of this we