diff options
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift')
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift index e643ffc..471c4fe 100644 --- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift +++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift @@ -247,13 +247,13 @@ class TunnelEditViewController: NSViewController { // We're creating a new tunnel self.tunnelsManager.add(tunnelConfiguration: tunnelConfiguration, onDemandOption: onDemandOption) { [weak self] result in self?.setUserInteractionEnabled(true) - if let error = result.error { + switch result { + case .failure(let error): ErrorPresenter.showErrorAlert(error: error, from: self) - return + case .success(let tunnel): + self?.dismiss(self) + self?.delegate?.tunnelSaved(tunnel: tunnel) } - let tunnel: TunnelContainer = result.value! - self?.dismiss(self) - self?.delegate?.tunnelSaved(tunnel: tunnel) } } } |