Make sure update directory != nil during cleanup

This commit is contained in:
Zorg committed 2016-07-30 17:49:37 -04:00
1 parent 1ca233eadf
commit 5ad5598a19
1 file changed
+5 -3
+5 -3
View File
@@ -607,9 +607,11 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self.agentConnection invalidate];
self.agentConnection = nil;
NSError *theError = nil;
if (![[[SUFileManager alloc] init] removeItemAtURL:[NSURL fileURLWithPath:self.updateDirectoryPath] error:&theError]) {
SULog(@"Couldn't remove update folder: %@.", theError);
if (self.updateDirectoryPath != nil) {
NSError *theError = nil;
if (![[[SUFileManager alloc] init] removeItemAtURL:[NSURL fileURLWithPath:self.updateDirectoryPath] error:&theError]) {
SULog(@"Couldn't remove update folder: %@.", theError);
}
}
exit(status);