diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 4b3e5713..c99164c4 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -141,8 +141,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification // We wait until the second launch, unless explicitly overridden via SUPromptUserOnFirstLaunchKey. shouldPrompt = [self.host objectForKey:SUPromptUserOnFirstLaunchKey] || hasLaunchedBefore; } - -#warning the logic for having launched before needs to be more intelligent now that Sparkle can through an XPC service and is re-entrant + if (!hasLaunchedBefore) { [self.host setBool:YES forUserDefaultsKey:SUHasLaunchedBeforeKey]; } @@ -151,7 +150,10 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification NSArray *profileInfo = [SUSystemProfiler systemProfileArrayForHost:self.host]; // Always say we're sending the system profile here so that the delegate displays the parameters it would send. if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) { - profileInfo = [profileInfo arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:YES]]; + NSArray *feedParameters = [self.delegate feedParametersForUpdater:self sendingSystemProfile:YES]; + if (feedParameters != nil) { + profileInfo = [profileInfo arrayByAddingObjectsFromArray:feedParameters]; + } } [self.userDriver requestUpdatePermissionWithSystemProfile:profileInfo reply:^(SUUpdatePermissionPromptResult *result) { @@ -503,7 +505,10 @@ static void SUCheckForUpdatesInBgReachabilityCheck(__weak SUUpdater *updater, SU NSArray *parameters = @[]; if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) { - parameters = [parameters arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]]; + NSArray *feedParameters = [self.delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]; + if (feedParameters != nil) { + parameters = [parameters arrayByAddingObjectsFromArray:feedParameters]; + } } if (sendingSystemProfile) { diff --git a/TestApplication/SUTestApplicationDelegate.m b/TestApplication/SUTestApplicationDelegate.m index 21179241..7d557799 100644 --- a/TestApplication/SUTestApplicationDelegate.m +++ b/TestApplication/SUTestApplicationDelegate.m @@ -76,7 +76,8 @@ static NSString * const UPDATED_VERSION = @"2.0"; assert(bundleURL != nil); // Copy main bundle into server directory - NSURL *destinationBundleURL = [serverDirectoryURL URLByAppendingPathComponent:bundleURL.lastPathComponent]; + NSString *lastBundleURLComponent = bundleURL.lastPathComponent; + NSURL *destinationBundleURL = [serverDirectoryURL URLByAppendingPathComponent:lastBundleURLComponent]; NSError *copyBundleError = nil; if (![fileManager copyItemAtURL:bundleURL toURL:destinationBundleURL error:©BundleError]) { NSLog(@"Failed to copy main bundle into server directory with error %@", copyBundleError); @@ -142,7 +143,9 @@ static NSString * const UPDATED_VERSION = @"2.0"; // Obtain the file attributes to get the file size of our update later NSError *fileAttributesError = nil; - NSDictionary *archiveFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:archiveURL.path error:&fileAttributesError]; + NSString *archiveURLPath = archiveURL.path; + assert(archiveURLPath != nil); + NSDictionary *archiveFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:archiveURLPath error:&fileAttributesError]; if (archiveFileAttributes == nil) { NSLog(@"Failed to retrieve file attributes from archive with error %@", fileAttributesError); assert(NO);