event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
- else if (nFlags != MF_SEPARATOR)
+ else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
{
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, nItem);
event.SetEventObject( this );
if ( menuId != -1 )
{
wxMenuBar *menuBar = GetMenuBar();
- if (menuBar)
+ if (menuBar && menuBar->FindItem(menuId))
{
// set status text even if the string is empty - this will at
// least remove the string from the item which was previously