add checks to avoid invalid inputs

This commit is contained in:
Bob Sun 2017-02-13 15:01:04 +08:00
parent 0b714ffec2
commit 3145ddacbe
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
4 changed files with 18 additions and 3 deletions

View file

@ -24,6 +24,12 @@ class PGPKeySettingTableViewController: UITableViewController {
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
if identifier == "savePGPKeySegue" {
guard pgpPublicKeyURLTextField.text != nil else {
return false
}
guard pgpPrivateKeyURLTextField.text != nil else {
return false
}
if URL(string: pgpPublicKeyURLTextField.text!)!.scheme! == "http" &&
URL(string: pgpPrivateKeyURLTextField.text!)!.scheme! == "http" {
let alertMessage = "HTTP connection is not supported."