src/macosx/native/sun/awt/awt.m

Print this page

        

@@ -314,11 +314,14 @@
 
     // Don't set the delegate until the NSApplication has been created and
     // its finishLaunching has initialized it.
     //  ApplicationDelegate is the support code for com.apple.eawt.
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);
+        id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
+        if (delegate != nil) {
+            OSXAPP_SetApplicationDelegate(delegate);
+        }        
     }];
 }
 
 - (void)starter:(NSArray*)args {
     NSAutoreleasePool *pool = [NSAutoreleasePool new];