]> granicus.if.org Git - handbrake/commitdiff
MacGui: do not try to import a preset even if the cancel button was clicked.
authorDamiano Galassi <damiog@gmail.com>
Thu, 15 Oct 2015 17:38:44 +0000 (19:38 +0200)
committerDamiano Galassi <damiog@gmail.com>
Fri, 16 Oct 2015 09:23:56 +0000 (11:23 +0200)
macosx/HBPresetsViewController.m

index fd8bc96774a8fe721b72aab5cd8897fb094c27a8..8933c7e27bd80edd4d682e606a25b1743501e8f1 100644 (file)
 
     [panel beginWithCompletionHandler:^(NSInteger result)
      {
-         if (result == NSOKButton)
+         if (result == NSFileHandlingPanelOKButton)
          {
              NSURL *presetExportDirectory = [panel.URL URLByDeletingLastPathComponent];
              [[NSUserDefaults standardUserDefaults] setURL:presetExportDirectory forKey:@"LastPresetExportDirectoryURL"];
      {
          [[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];
+                 }
              }
          }
      }];