From 06642bba209b74a3cbb9d9596f853255b50a387b Mon Sep 17 00:00:00 2001 From: Andy Matuschak Date: Fri, 30 Sep 2011 09:42:30 -0700 Subject: [PATCH] Fix to reachability patch in 9cc1905f87bc26d1ebc8102ef1e14256569fe3b2 for file:// URLs, which were crashing --- SUUpdater.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SUUpdater.m b/SUUpdater.m index c7a5a01c..21e4d415 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -235,8 +235,12 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault const char *hostname = [[[theDict objectForKey: @"feedURL"] host] cStringUsingEncoding: NSUTF8StringEncoding]; SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, hostname); - Boolean reachabilityResult = SCNetworkReachabilityGetFlags(reachability, &flags); - CFRelease(reachability); + Boolean reachabilityResult = NO; + // If the feed's using a file:// URL, we won't be able to use reachability. + if (reachability != NULL) { + SCNetworkReachabilityGetFlags(reachability, &flags); + CFRelease(reachability); + } if( reachabilityResult ) {