From eb33a418d57e9c566aa37fe9e230d5debeb766cd Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 19 Jan 2015 14:41:32 +0000 Subject: Avoid potential crash if Fl::focus() returns NULL. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10527 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index a50b8c88c..9cad4f3b6 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2256,7 +2256,8 @@ static FLTextInputContext* fltextinputcontext_instance = nil; Fl::first_window(window); cocoaKeyboardHandler(theEvent); in_key_event = YES; - if (Fl::focus()->as_gl_window()) { // ignore text input methods for GL windows + Fl_Widget *f = Fl::focus(); + if (f && f->as_gl_window()) { // ignore text input methods for GL windows need_handle = YES; [FLView prepareEtext:[theEvent characters]]; } else { -- cgit v1.2.3