From b982e9460c25543faf70bd9dd33d28400b197d58 Mon Sep 17 00:00:00 2001 From: Zorg Date: Wed, 29 Jun 2016 00:09:22 -0400 Subject: [PATCH] Handle package installer (non-guided) errors --- Sparkle/SUPackageInstaller.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sparkle/SUPackageInstaller.m b/Sparkle/SUPackageInstaller.m index aa636c9d..4177113d 100644 --- a/Sparkle/SUPackageInstaller.m +++ b/Sparkle/SUPackageInstaller.m @@ -49,6 +49,11 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open"; - (BOOL)performSecondStageAllowingAuthorization:(BOOL)__unused allowsAuthorization fileOperationToolPath:(NSString *)__unused fileOperationToolPath environment:(SUAuthorizationEnvironment * _Nullable)__unused authorizationEnvironment allowingUI:(BOOL)allowsUI error:(NSError * __autoreleasing *)error { + if (!allowsUI) { + if (error != NULL) { + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Package installer cannot continue if showing UI is not allowed." }]; + } + } return allowsUI; } @@ -67,6 +72,10 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open"; } @catch (NSException *exception) { SULog(@"Error: Failed to launch package installer: %@", exception); + if (error != NULL) { + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Package installer failed to launch." }]; + } + return NO; } return YES;