From 71d64a837ed49a20b436a339cd28872ed17a9a3d Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 11 Jun 2021 09:47:24 -0700 Subject: [PATCH] Avoid crash when user denies keychain access Co-Authored-By: Antonio Scandurra --- gpui/src/platform/mac/platform.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gpui/src/platform/mac/platform.rs b/gpui/src/platform/mac/platform.rs index 1f1056b3a8..5d5e69263d 100644 --- a/gpui/src/platform/mac/platform.rs +++ b/gpui/src/platform/mac/platform.rs @@ -523,7 +523,7 @@ impl platform::Platform for MacPlatform { let status = SecItemCopyMatching(attrs.as_concrete_TypeRef(), &mut result); match status { security::errSecSuccess => {} - security::errSecItemNotFound => return None, + security::errSecItemNotFound | security::errSecUserCanceled => return None, _ => panic!("reading password failed: {}", status), } @@ -657,6 +657,7 @@ mod security { } pub const errSecSuccess: OSStatus = 0; + pub const errSecUserCanceled: OSStatus = -128; pub const errSecItemNotFound: OSStatus = -25300; }