summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Fl_cocoa.mm4
1 files 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;
}