]> git.saurik.com Git - wxWidgets.git/commitdiff
Added test to prevent crash in LogMenuEvent
authorJulian Smart <julian@anthemion.co.uk>
Fri, 2 Mar 2001 12:49:26 +0000 (12:49 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 2 Mar 2001 12:49:26 +0000 (12:49 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9454 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/menu/menu.cpp

index 98f94475cb20ec0a449e1dcd55ef5c32711cb4ab..bb2e4de3b6d16a553bca316258550a483ad2e311 100644 (file)
@@ -346,6 +346,8 @@ wxMenuItem *MyFrame::GetLastMenuItem() const
 void MyFrame::LogMenuEvent(const wxCommandEvent& event)
 {
     int id = event.GetId();
 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() )
     {
     wxString msg = wxString::Format("Menu command %d", id);
     if ( GetMenuBar()->FindItem(id)->IsCheckable() )
     {