aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/TunnelImporter.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-03-05 15:57:11 +0530
committerRoopesh Chander <roop@roopc.net>2019-03-05 16:11:57 +0530
commitfe4f8b666d0d2c3b532ee145e205a30a4ad56b82 (patch)
tree92ffee04734caa2d63d83df6a3e9a6edb2b3f528 /WireGuard/WireGuard/UI/TunnelImporter.swift
parentImporting: Make use of lastError returned from TunnelsManager.addMultiple() (diff)
downloadwireguard-apple-fe4f8b666d0d2c3b532ee145e205a30a4ad56b82.tar.xz
wireguard-apple-fe4f8b666d0d2c3b532ee145e205a30a4ad56b82.zip
Importing: Only the main thread shall access lastFileImportErrorText
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/TunnelImporter.swift')
-rw-r--r--WireGuard/WireGuard/UI/TunnelImporter.swift16
1 files changed, 8 insertions, 8 deletions
diff --git a/WireGuard/WireGuard/UI/TunnelImporter.swift b/WireGuard/WireGuard/UI/TunnelImporter.swift
index 1b0fd7e5..70e536ff 100644
--- a/WireGuard/WireGuard/UI/TunnelImporter.swift
+++ b/WireGuard/WireGuard/UI/TunnelImporter.swift
@@ -33,22 +33,22 @@ class TunnelImporter {
do {
fileContents = try String(contentsOf: url)
} catch let error {
- if let cocoaError = error as? CocoaError, cocoaError.isFileError {
- lastFileImportErrorText = (title: tr("alertCantOpenInputConfFileTitle"), message: error.localizedDescription)
- } else {
- lastFileImportErrorText = (title: tr("alertCantOpenInputConfFileTitle"), message: tr(format: "alertCantOpenInputConfFileMessage (%@)", fileName))
- }
DispatchQueue.main.async {
+ if let cocoaError = error as? CocoaError, cocoaError.isFileError {
+ lastFileImportErrorText = (title: tr("alertCantOpenInputConfFileTitle"), message: error.localizedDescription)
+ } else {
+ lastFileImportErrorText = (title: tr("alertCantOpenInputConfFileTitle"), message: tr(format: "alertCantOpenInputConfFileMessage (%@)", fileName))
+ }
configs.append(nil)
dispatchGroup.leave()
}
return
}
let tunnelConfiguration = try? TunnelConfiguration(fromWgQuickConfig: fileContents, called: fileBaseName)
- if tunnelConfiguration == nil {
- lastFileImportErrorText = (title: tr("alertBadConfigImportTitle"), message: tr(format: "alertBadConfigImportMessage (%@)", fileName))
- }
DispatchQueue.main.async {
+ if tunnelConfiguration == nil {
+ lastFileImportErrorText = (title: tr("alertBadConfigImportTitle"), message: tr(format: "alertBadConfigImportMessage (%@)", fileName))
+ }
configs.append(tunnelConfiguration)
dispatchGroup.leave()
}