From 742e32b875a2e6a7c879ba0a84fb7512608c25fd Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Thu, 15 Oct 2015 19:38:44 +0200 Subject: MacGui: do not try to import a preset even if the cancel button was clicked. --- macosx/HBPresetsViewController.m | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'macosx') diff --git a/macosx/HBPresetsViewController.m b/macosx/HBPresetsViewController.m index fd8bc9677..8933c7e27 100644 --- a/macosx/HBPresetsViewController.m +++ b/macosx/HBPresetsViewController.m @@ -101,7 +101,7 @@ [panel beginWithCompletionHandler:^(NSInteger result) { - if (result == NSOKButton) + if (result == NSFileHandlingPanelOKButton) { NSURL *presetExportDirectory = [panel.URL URLByDeletingLastPathComponent]; [[NSUserDefaults standardUserDefaults] setURL:presetExportDirectory forKey:@"LastPresetExportDirectoryURL"]; @@ -133,19 +133,22 @@ { [[NSUserDefaults standardUserDefaults] setURL:panel.directoryURL forKey:@"LastPresetImportDirectoryURL"]; - for (NSURL *url in panel.URLs) + if (result == NSFileHandlingPanelOKButton) { - NSError *error; - HBPreset *import = [[HBPreset alloc] initWithContentsOfURL:url error:&error]; - - if (import == nil) - { - [self presentError:error]; - } - - for (HBPreset *child in import.children) + for (NSURL *url in panel.URLs) { - [self.presets addPreset:child]; + NSError *error; + HBPreset *import = [[HBPreset alloc] initWithContentsOfURL:url error:&error]; + + if (import == nil) + { + [self presentError:error]; + } + + for (HBPreset *child in import.children) + { + [self.presets addPreset:child]; + } } } }]; -- cgit v1.2.3