Browse Source

Fix exec_bad_access if stopNotifier() is called before deinit()

lchenay 10 years ago
parent
commit
7d63476ddd
1 changed files with 3 additions and 2 deletions
  1. 3 2
      Reachability.swift

+ 3 - 2
Reachability.swift

@@ -149,8 +149,9 @@ public class Reachability: NSObject {
     
 
     public func stopNotifier() {
-
-        SCNetworkReachabilitySetCallback(reachabilityRef!, nil, nil)
+        if let reachabilityRef = reachabilityRef {
+            SCNetworkReachabilitySetCallback(reachabilityRef, nil, nil)
+        }
         reachabilityRef = nil
     }