diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 4e6f8737b8..44af089624 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -252,7 +252,7 @@ pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef long keyval = wxMacTranslateKey(keychar, keycode) ; wxWindow* focus = wxWindow::FindFocus() ; - if ( wxTheApp->MacSendKeyDownEvent( focus , keyval , rec.modifiers , rec.when , rec.where.h , rec.where.v ) ) + if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( focus , keyval , rec.modifiers , rec.when , rec.where.h , rec.where.v ) ) { // was handled internally result = noErr ; diff --git a/src/mac/toplevel.cpp b/src/mac/toplevel.cpp index 4e6f8737b8..44af089624 100644 --- a/src/mac/toplevel.cpp +++ b/src/mac/toplevel.cpp @@ -252,7 +252,7 @@ pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef long keyval = wxMacTranslateKey(keychar, keycode) ; wxWindow* focus = wxWindow::FindFocus() ; - if ( wxTheApp->MacSendKeyDownEvent( focus , keyval , rec.modifiers , rec.when , rec.where.h , rec.where.v ) ) + if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( focus , keyval , rec.modifiers , rec.when , rec.where.h , rec.where.v ) ) { // was handled internally result = noErr ;