Safer work with NSConnection

This commit is contained in:
Sergey Tatarchuk authored and Dmytro Tretiakov committed 2014-07-30 16:59:58 +03:00
1 parent e24212f797
commit bb645e9832
1 file changed
+10 -4
+10 -4
View File
@@ -48,11 +48,17 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
- (BOOL)isUpdateInProgress
{
BOOL result = NO;
NSConnection *connection = [NSConnection connectionWithRegisteredName:[NSString stringWithFormat:@"Sparkle %@", [[host bundle] bundleIdentifier]] host:nil];
if (connection != nil)
@try
{
NSConnection *connection = [NSConnection connectionWithRegisteredName:[NSString stringWithFormat:@"Sparkle %@", [[host bundle] bundleIdentifier]] host:nil];
if (connection != nil)
{
NSDistantObject *proxyBundle = [connection rootProxy];
result = proxyBundle != nil;
}
}
@catch (NSException *exception)
{
NSDistantObject *proxyBundle = [connection rootProxy];
result = proxyBundle != nil;
}
return result;