From: Julian Smart Date: Fri, 2 Mar 2001 12:49:26 +0000 (+0000) Subject: Added test to prevent crash in LogMenuEvent X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d3d69314279eca9884f45932e49948273e1e2ef4?ds=sidebyside Added test to prevent crash in LogMenuEvent git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9454 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index 98f94475cb..bb2e4de3b6 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -346,6 +346,8 @@ wxMenuItem *MyFrame::GetLastMenuItem() const void MyFrame::LogMenuEvent(const wxCommandEvent& event) { int id = event.GetId(); + if (!GetMenuBar()->FindItem(id)) + return; wxString msg = wxString::Format("Menu command %d", id); if ( GetMenuBar()->FindItem(id)->IsCheckable() ) {