diff options
author | rowanbeentje <rowan@beent.je> | 2009-08-11 22:48:35 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-08-11 22:48:35 +0000 |
commit | 8db453b2c23e84e16c492f0a0856463bb866c620 (patch) | |
tree | 83f62a8318d0d82bd79b9ceb94bad4794a3e5828 /Source/TableDocument.m | |
parent | 9c4f6b6fd05acc7e10ac50ddf66eb25f5cf9344f (diff) | |
download | sequelpro-8db453b2c23e84e16c492f0a0856463bb866c620.tar.gz sequelpro-8db453b2c23e84e16c492f0a0856463bb866c620.tar.bz2 sequelpro-8db453b2c23e84e16c492f0a0856463bb866c620.zip |
- Merge in r1191 from SP0.9.6 branch, fixing a crasher for blank passwords by checking a keychain item is present before trying to load it
- Also make keychain checks more robust when supplying nil values as some of the parameters
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index a7c0d176..c36a2e35 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2426,11 +2426,14 @@ * Invoked when the current connection needs a password from the Keychain. */ - (NSString *)keychainPasswordForConnection:(MCPConnection *)connection -{ - SPKeychain *keychain = [[SPKeychain alloc] init]; +{ + // If no keychain item is available, return an empty password + if (![connectionController connectionKeychainItemName]) return @""; + + // Otherwise, pull the password from the keychain using the details from this connection + SPKeychain *keychain = [[SPKeychain alloc] init]; NSString *password = [keychain getPasswordForName:[connectionController connectionKeychainItemName] account:[connectionController connectionKeychainItemAccount]]; - [keychain release]; return password; |