mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Wrap initializer with standard if self != nil check
This commit is contained in:
1 parent
b58eeeabb5
commit
9ee8a6d314
1 file changed
+20
-18
Vendored
+20
-18
@@ -56,25 +56,27 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SUUserDriver>)userDriver delegate:(id <SUUpdaterDelegate>)theDelegate
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
// Use explicit class to use the correct bundle even when subclassed
|
||||
self.sparkleBundle = [NSBundle bundleForClass:[SUUpdater class]];
|
||||
if (!self.sparkleBundle) {
|
||||
SULog(@"Error: SUUpdater can't find Sparkle.framework it belongs to");
|
||||
return nil;
|
||||
|
||||
if (self != nil) {
|
||||
// Use explicit class to use the correct bundle even when subclassed
|
||||
self.sparkleBundle = [NSBundle bundleForClass:[SUUpdater class]];
|
||||
if (!self.sparkleBundle) {
|
||||
SULog(@"Error: SUUpdater can't find Sparkle.framework it belongs to");
|
||||
return nil;
|
||||
}
|
||||
|
||||
host = [[SUHost alloc] initWithBundle:bundle];
|
||||
|
||||
_userDriver = userDriver;
|
||||
|
||||
delegate = theDelegate;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDriverDidFinish:) name:SUUpdateDriverFinishedNotification object:nil];
|
||||
|
||||
// This runs the permission prompt if needed, but never before the app has finished launching because the runloop may not have ran before that
|
||||
// We will also take precaussions if a developer instantiates an updater themselves where the application may not be completely finished launching yet
|
||||
[self performSelector:@selector(startUpdateCycle) withObject:nil afterDelay:1];
|
||||
}
|
||||
|
||||
host = [[SUHost alloc] initWithBundle:bundle];
|
||||
|
||||
_userDriver = userDriver;
|
||||
|
||||
delegate = theDelegate;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDriverDidFinish:) name:SUUpdateDriverFinishedNotification object:nil];
|
||||
|
||||
// This runs the permission prompt if needed, but never before the app has finished launching because the runloop may not have ran before that
|
||||
// We will also take precaussions if a developer instantiates an updater themselves where the application may not be completely finished launching yet
|
||||
[self performSelector:@selector(startUpdateCycle) withObject:nil afterDelay:1];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user