From 4a5bc92fcbf01ac914d8e1b40f38843adad4e169 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 18 Dec 2020 13:40:53 +0100 Subject: [PATCH] Remove password inside try/catch --- TunnelKit/Sources/AppExtension/Keychain.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/TunnelKit/Sources/AppExtension/Keychain.swift b/TunnelKit/Sources/AppExtension/Keychain.swift index 4901403..23340d4 100644 --- a/TunnelKit/Sources/AppExtension/Keychain.swift +++ b/TunnelKit/Sources/AppExtension/Keychain.swift @@ -103,6 +103,7 @@ public class Keychain { guard password != currentPassword else { return } + removePassword(for: username) } catch let e as KeychainError { // rethrow cancelation @@ -113,8 +114,6 @@ public class Keychain { // otherwise, no pre-existing password } - removePassword(for: username) - var query = [String: Any]() setScope(query: &query) query[kSecClass as String] = kSecClassGenericPassword