aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-07-09 00:40:25 +0000
committerrowanbeentje <rowan@beent.je>2009-07-09 00:40:25 +0000
commitb5f8fa76b54e16448de8e723240daf8159860d6d (patch)
tree008a98234e1ba5bd5d3a889f48ace30a5f2fd961 /Source/TableDocument.m
parent26675cbe2b899dc1aa6613f8345097eca1d92a94 (diff)
downloadsequelpro-b5f8fa76b54e16448de8e723240daf8159860d6d.tar.gz
sequelpro-b5f8fa76b54e16448de8e723240daf8159860d6d.tar.bz2
sequelpro-b5f8fa76b54e16448de8e723240daf8159860d6d.zip
- Add a number of additional nil checks as protection against further recurrences of Issue #331
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m16
1 files changed, 10 insertions, 6 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 42d1309d..d6758112 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -270,7 +270,7 @@
if([[self user] length])
[connection setValue:[self user] forKey:@"username"];
[connection setValue:[self host] forKey:@"hostname"];
- if([[connectionController port] length])
+ if([connectionController port] &&[[connectionController port] length])
[connection setValue:[connectionController port] forKey:@"port"];
[connection setValue:selectedDatabase forKey:@"database"];
[connection setValue:versionForPrint forKey:@"version"];
@@ -1290,7 +1290,9 @@
- (NSString *)host
{
if ([connectionController type] == SP_CONNECTION_SOCKET) return @"localhost";
- return [connectionController host];
+ NSString theHost = [connectionController host];
+ if (!theHost) theHost = @"";
+ return theHost;
}
/**
@@ -1298,13 +1300,13 @@
*/
- (NSString *)name
{
- if ([[connectionController name] length]) {
+ if ([connectionController name] && [[connectionController name] length]) {
return [connectionController name];
}
if ([connectionController type] == SP_CONNECTION_SOCKET) {
- return [NSString stringWithFormat:@"%@@%@", [connectionController user], [connectionController host]];
+ return [NSString stringWithFormat:@"%@@localhost", [connectionController user]?[connectionController user]:@""];
}
- return [NSString stringWithFormat:@"%@@%@", [connectionController user], [connectionController host]];
+ return [NSString stringWithFormat:@"%@@%@", [connectionController user]?[connectionController user]:@"", [connectionController host]?[connectionController host]:@""];
}
/**
@@ -1336,7 +1338,9 @@
*/
- (NSString *)user
{
- return [connectionController user];
+ NSString theUser = [connectionController user];
+ if (!theUser) theUser = @"";
+ return theUser;
}
#pragma mark -