From a37f528f742c2b27db3995c7b22147d9ef4d7049 Mon Sep 17 00:00:00 2001
From: Damiano Galassi <damiog@gmail.com>
Date: Thu, 28 Jan 2016 07:32:16 +0100
Subject: [PATCH] MacGui: fix some static anaylizer warnings.

---
 macosx/HBAudioTrack.h     |  8 ++++----
 macosx/HBController.m     | 11 +++++++----
 macosx/HBPresetsManager.m |  4 +++-
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/macosx/HBAudioTrack.h b/macosx/HBAudioTrack.h
index 7bf5c8ecc..c259812e8 100644
--- a/macosx/HBAudioTrack.h
+++ b/macosx/HBAudioTrack.h
@@ -46,9 +46,9 @@ extern NSString *keyAudioBitrate;
 
 @property (nonatomic, strong) NSDictionary *track;
 @property (nonatomic, strong, nullable) NSDictionary *codec;
-@property (nonatomic, strong) NSDictionary *mixdown;
-@property (nonatomic, strong) NSDictionary *sampleRate;
-@property (nonatomic, strong) NSDictionary *bitRate;
+@property (nonatomic, strong, nullable) NSDictionary *mixdown;
+@property (nonatomic, strong, nullable) NSDictionary *sampleRate;
+@property (nonatomic, strong, nullable) NSDictionary *bitRate;
 @property (nonatomic) double drc;
 @property (nonatomic) double gain;
 @property (nonatomic) int container;
@@ -63,7 +63,7 @@ extern NSString *keyAudioBitrate;
 @property (nonatomic, readonly) BOOL enabled;
 
 - (void) setTrackFromIndex: (int) aValue;
-- (BOOL) setCodecFromName: (NSString *) aValue;
+- (BOOL) setCodecFromName: (nullable NSString *) aValue;
 - (void) setMixdownFromName: (NSString *) aValue;
 - (void) setSampleRateFromName: (NSString *) aValue;
 - (void) setBitRateFromName: (NSString *) aValue;
diff --git a/macosx/HBController.m b/macosx/HBController.m
index 94f626b7f..923256a45 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -845,7 +845,7 @@
 {
     [self updateFileExtension:nil];
 
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"])
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"] && self.job)
     {
         // Generate a new file name
         NSString *fileName = [HBUtilities automaticNameForJob:self.job];
@@ -858,10 +858,13 @@
 
 - (void)updateFileExtension:(NSNotification *)notification
 {
-    NSString *extension = [HBUtilities automaticExtForJob:self.job];
-    if (![extension isEqualTo:self.job.destURL.pathExtension])
+    if (self.job)
     {
-        self.job.destURL = [[self.job.destURL URLByDeletingPathExtension] URLByAppendingPathExtension:extension];
+        NSString *extension = [HBUtilities automaticExtForJob:self.job];
+        if (![extension isEqualTo:self.job.destURL.pathExtension])
+        {
+            self.job.destURL = [[self.job.destURL URLByDeletingPathExtension] URLByAppendingPathExtension:extension];
+        }
     }
 }
 
diff --git a/macosx/HBPresetsManager.m b/macosx/HBPresetsManager.m
index 275d79706..aa78455ff 100644
--- a/macosx/HBPresetsManager.m
+++ b/macosx/HBPresetsManager.m
@@ -84,7 +84,9 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification";
     int major, minor, micro;
     hb_presets_current_version(&major, &minor, &micro);
 
-    if ([dict[@"VersionMajor"] intValue] > major)
+    if ([dict[@"VersionMajor"] intValue] > major ||
+        ([dict[@"VersionMajor"] intValue] == major && [dict[@"VersionMinor"] intValue] > minor) ||
+        ([dict[@"VersionMajor"] intValue] == major && [dict[@"VersionMinor"] intValue] == minor && [dict[@"VersionMicro"] intValue] > micro))
     {
         return YES;
     }
-- 
2.40.0