Permalink
Browse files

[Issue #274] Fixing crash when creating network reachability when bas…

…eURL is nil
  • Loading branch information...
1 parent 51bd23d commit ce23a0757b26c5f4190df52e73ae729be2255643 @mattt mattt committed Apr 25, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 AFNetworking/AFHTTPClient.m
View
8 AFNetworking/AFHTTPClient.m
@@ -372,10 +372,14 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
}
- (void)startMonitoringNetworkReachability {
- [self stopMonitoringNetworkReachability];
+ [self stopMonitoringNetworkReachability];
+
+ if (!self.baseURL) {
+ return;
+ }
self.networkReachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [[self.baseURL host] UTF8String]);
-
+
AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status){
self.networkReachabilityStatus = status;
if (self.networkReachabilityStatusBlock) {

0 comments on commit ce23a07

Please sign in to comment.