diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-22 05:12:53 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-22 05:13:04 +0100 |
commit | b0b6866c518735ddb96b7f54a1ad2aec6972116f (patch) | |
tree | ce739a103226e50d46b9e20641ecf8b23cb3dfaf /WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift | |
parent | Removing a tunnel from iOS's settings is now immediately reflected in app (diff) | |
download | wireguard-apple-b0b6866c518735ddb96b7f54a1ad2aec6972116f.tar.xz wireguard-apple-b0b6866c518735ddb96b7f54a1ad2aec6972116f.zip |
Do not crash if we can't get socket.fileDescriptor
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift b/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift index fd6bb9b..e44d298 100644 --- a/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift +++ b/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift @@ -38,7 +38,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider { packetTunnelSettingsGenerator = PacketTunnelSettingsGenerator(tunnelConfiguration: tunnelConfiguration, resolvedEndpoints: resolvedEndpoints) - let fileDescriptor = packetFlow.value(forKeyPath: "socket.fileDescriptor") as! Int32 //swiftlint:disable:this force_cast + let fileDescriptor = (packetFlow.value(forKeyPath: "socket.fileDescriptor") as? Int32) ?? -1 if fileDescriptor < 0 { wg_log(.error, staticMessage: "Starting tunnel failed: Could not determine file descriptor") errorNotifier.notify(PacketTunnelProviderError.couldNotDetermineFileDescriptor) |