aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/TunnelViewModel.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-10 17:02:30 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-10 17:02:30 +0530
commit290f83d5ef4d26e11d0b6eaccd47fcda7d359ae3 (patch)
tree8f1c9edb5f97bfd327bfa6b84e044ebba71d41e5 /WireGuard/WireGuard/UI/TunnelViewModel.swift
parentVPN: When activating while another tunnel is active, deactivate the other tunnel (diff)
downloadwireguard-apple-290f83d5ef4d26e11d0b6eaccd47fcda7d359ae3.tar.xz
wireguard-apple-290f83d5ef4d26e11d0b6eaccd47fcda7d359ae3.zip
Model: Ensure that a TunnelConfiguration always has a valid array of peers
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/TunnelViewModel.swift')
-rw-r--r--WireGuard/WireGuard/UI/TunnelViewModel.swift3
1 files changed, 1 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/TunnelViewModel.swift b/WireGuard/WireGuard/UI/TunnelViewModel.swift
index 16da1c2..94e3e6d 100644
--- a/WireGuard/WireGuard/UI/TunnelViewModel.swift
+++ b/WireGuard/WireGuard/UI/TunnelViewModel.swift
@@ -441,8 +441,7 @@ class TunnelViewModel {
return .error("Two or more peers cannot have the same public key")
}
- let tunnelConfiguration = TunnelConfiguration(interface: interfaceConfiguration)
- tunnelConfiguration.peers = peerConfigurations
+ let tunnelConfiguration = TunnelConfiguration(interface: interfaceConfiguration, peers: peerConfigurations)
return .saved(tunnelConfiguration)
}
}