]> khamidou — GitHub mirrors - electron.git/commitdiff
mac: Don't create button without title, fixes #631
authorCheng Zhao <zcbenz@gmail.com>
Wed, 1 Oct 2014 07:51:32 +0000 (15:51 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 1 Oct 2014 07:51:32 +0000 (15:51 +0800)
atom/browser/ui/message_box_mac.mm

index bc2c5c692cf356a510a800eacb3fe9af531b92ce..147a09d0d27d68ddc68c169c3dbd6aabaf6f2704 100644 (file)
@@ -75,6 +75,9 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window,
 
   for (size_t i = 0; i < buttons.size(); ++i) {
     NSString* title = base::SysUTF8ToNSString(buttons[i]);
+    // An empty title causes crash on OS X.
+    if (buttons[i].empty())
+      title = @"(empty)";
     NSButton* button = [alert addButtonWithTitle:title];
     [button setTag:i];
   }