diff --git a/panda/src/cocoadisplay/cocoaPandaAppDelegate.mm b/panda/src/cocoadisplay/cocoaPandaAppDelegate.mm index cbb84bc205..f64b2be56a 100644 --- a/panda/src/cocoadisplay/cocoaPandaAppDelegate.mm +++ b/panda/src/cocoadisplay/cocoaPandaAppDelegate.mm @@ -39,7 +39,8 @@ // Ask all the windows whether they are OK to be closed. bool should_close = true; for (NSWindow *window in [app windows]) { - if (![[window delegate] windowShouldClose:window]) { + id delegate = [window delegate]; + if (delegate != nil && ![delegate windowShouldClose:window]) { should_close = false; } }