Importing: Show error when the zip file contains no .conf files

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-11-01 02:04:26 +05:30
parent cf7966e876
commit 193b8c2596
1 changed files with 4 additions and 0 deletions

View File

@ -159,6 +159,10 @@ class TunnelsListTableViewController: UITableViewController {
} catch (let error) { } catch (let error) {
print("Error opening zip archive: \(error)") print("Error opening zip archive: \(error)")
} }
guard (unarchivedFiles.count > 0) else {
showErrorAlert(title: "No configurations found", message: "Zip archive doesn't contain any .conf files")
return
}
var numberOfConfigFilesWithErrors = 0 var numberOfConfigFilesWithErrors = 0
var tunnelConfigurationsToAdd: [TunnelConfiguration] = [] var tunnelConfigurationsToAdd: [TunnelConfiguration] = []
for unarchivedFile in unarchivedFiles { for unarchivedFile in unarchivedFiles {