Skip to content

Commit

Permalink
Verify relaunchToolPath is not nil
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Jul 13, 2015
1 parent ceee82c commit e9fa7c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sparkle/SUBasicUpdateDriver.m
Expand Up @@ -444,7 +444,8 @@ - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)
if ([updaterDelegate respondsToSelector:@selector(updaterWillRelaunchApplication:)])
[updaterDelegate updaterWillRelaunchApplication:self.updater];

if (!self.relaunchPath || ![[NSFileManager defaultManager] fileExistsAtPath:self.relaunchPath]) {
NSString *relaunchToolPath = [[NSBundle bundleWithPath:self.relaunchPath] executablePath];
if (!relaunchToolPath || ![[NSFileManager defaultManager] fileExistsAtPath:self.relaunchPath]) {
// Note that we explicitly use the host app's name here, since updating plugin for Mail relaunches Mail, not just the plugin.
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{
NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [self.host name]],
Expand All @@ -458,7 +459,6 @@ - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)
if ([updaterDelegate respondsToSelector:@selector(pathToRelaunchForUpdater:)]) {
pathToRelaunch = [updaterDelegate pathToRelaunchForUpdater:self.updater];
}
NSString *relaunchToolPath = [[NSBundle bundleWithPath:self.relaunchPath] executablePath];
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:@[[self.host bundlePath],
pathToRelaunch,
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
Expand Down

0 comments on commit e9fa7c3

Please sign in to comment.