From b171a28de448dbe1347672044250f8b2ed37df32 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 13 Nov 2017 14:43:58 +0000 Subject: MacOS: make -[FLWindowDelegate windowShouldClose:] more robust by testing for NULL pointer. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12559 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 10e727021..1a33422a4 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1430,8 +1430,8 @@ static FLWindowDelegate *flwindowdelegate_instance = nil; - (BOOL)windowShouldClose:(id)fl { fl_lock_function(); - Fl::handle( FL_CLOSE, [(FLWindow *)fl getFl_Window] ); // this might or might not close the window - fl_unlock_function(); + Fl_Window *win = [(FLWindow *)fl getFl_Window]; + if (win) Fl::handle(FL_CLOSE, win); // this might or might not close the window fl_unlock_function(); // the system doesn't need to send [fl close] because FLTK does it when needed return NO; } -- cgit v1.2.3