mac: Guard against closed window, fixes #536.

This commit is contained in:
Cheng Zhao 2014-07-31 10:31:08 +08:00
parent 476f545a67
commit 5086873f78
2 changed files with 2 additions and 2 deletions

View file

@ -55,7 +55,7 @@ void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
// Run modal dialog with parent window and return user's choice.
int RunModalDialog(NSSavePanel* dialog, atom::NativeWindow* parent_window) {
__block int chosen = NSFileHandlingPanelCancelButton;
if (parent_window == NULL) {
if (!parent_window || !parent_window->GetNativeWindow()) {
chosen = [dialog runModal];
} else {
NSWindow* window = parent_window->GetNativeWindow();

View file

@ -99,7 +99,7 @@ int ShowMessageBox(NativeWindow* parent_window,
// Use runModal for synchronous alert without parent, since we don't have a
// window to wait for.
if (!parent_window)
if (!parent_window || !parent_window->GetNativeWindow())
return [[alert autorelease] runModal];
int ret_code = -1;