Browse Source

Do not call nw_path_monitor_cancel on nil monitor

Miro 1 year ago
parent
commit
2526e54159

+ 4 - 2
MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/Network/Reachability/DefaultRouteMonitor.m

@@ -192,8 +192,10 @@ NetworkReachability nw_interface_type_network_reachability(nw_interface_type_t i
         // Note: this monitor cannot be used after being cancelled. Its update handler will not
         // fire again and cannot be restarted with nw_path_monitor_start. A new monitor must be
         // created and started.
-        nw_path_monitor_cancel(self->monitor);
-        self->monitor = nil;
+        if (self->monitor != nil) {
+            nw_path_monitor_cancel(self->monitor);
+            self->monitor = nil;
+        }
     }
 }