Fixing bug 444128, |MacApplicationDelegate| in toolkit throws ObjC exception when creating a |NSMenuItem| with a |nil| |NSString *|. r=josh, sr=roc
authorNick Kreeger <nick.kreeger@park.edu>
Tue, 15 Jul 2008 10:27:55 -0700
changeset 15953 7b209553f0b5f5b56145157a33de0d79fad20c92
parent 15952 613a1fe1d5f975101b996c261f724fa8b79b3355
child 15954 61f90cca8c3c036f112f97a14135c4c35390aa9f
push id635
push usernick.kreeger@park.edu
push dateTue, 15 Jul 2008 17:27:22 +0000
treeherdermozilla-central@7b209553f0b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh, roc
bugs444128
milestone1.9.1a1pre
Fixing bug 444128, |MacApplicationDelegate| in toolkit throws ObjC exception when creating a |NSMenuItem| with a |nil| |NSString *|. r=josh, sr=roc
toolkit/xre/MacApplicationDelegate.mm
--- a/toolkit/xre/MacApplicationDelegate.mm
+++ b/toolkit/xre/MacApplicationDelegate.mm
@@ -240,19 +240,22 @@ static NSWindow* GetCocoaWindowForXULWin
   while (NS_SUCCEEDED(windowList->HasMoreElements(&more)) && more) {
     // Get our native window
     nsCOMPtr<nsISupports> xulWindow;
     rv = windowList->GetNext(getter_AddRefs(xulWindow));
     NS_ENSURE_SUCCESS(rv, nil);
     NSWindow *cocoaWindow = GetCocoaWindowForXULWindow(xulWindow);
     if (!cocoaWindow) continue;
     
+    NSString *windowTitle = [cocoaWindow title];
+    if (!windowTitle) continue;
+    
     // Now, create a menu item, and add it to the menu
     NSMenuItem *menuItem = [[NSMenuItem alloc]
-                              initWithTitle:[cocoaWindow title]
+                              initWithTitle:windowTitle
                                      action:@selector(dockMenuItemSelected:)
                               keyEquivalent:@""];
     [menuItem setTarget:self];
     [menuItem setRepresentedObject:cocoaWindow];
 
     // If this is the foreground window, put a checkmark next to it
     if (SameCOMIdentity(xulWindow, frontWindow))
       [menuItem setState:NSOnState];