diff --git a/WireGuard/WireGuard/VPN/TunnelsManager.swift b/WireGuard/WireGuard/VPN/TunnelsManager.swift index 2276ef7..b0db3c0 100644 --- a/WireGuard/WireGuard/VPN/TunnelsManager.swift +++ b/WireGuard/WireGuard/VPN/TunnelsManager.swift @@ -402,8 +402,13 @@ class TunnelContainer: NSObject { } fileprivate func startDeactivation() { - assert(status == .active || status == .waiting) let session = (tunnelProvider.connection as! NETunnelProviderSession) + if (status == .waiting && (session.status == .disconnected || session.status == .invalid)) { + status = .inactive + self.onDeactivationComplete?() + self.onDeactivationComplete = nil + return + } session.stopTunnel() }