diff options
author | stuconnolly <stuart02@gmail.com> | 2013-01-16 20:42:19 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2013-01-16 20:42:19 +0000 |
commit | c2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3 (patch) | |
tree | cac953a322f14b4ce8bfbbee92d545db4b3a7e90 | |
parent | 7aa53f9496cab4625806ca38fad65d0ef6c93452 (diff) | |
download | sequelpro-c2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3.tar.gz sequelpro-c2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3.tar.bz2 sequelpro-c2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3.zip |
PostgresKit: When extracting an error field check it's not null before returning it.
-rw-r--r-- | Frameworks/PostgresKit/Source/PGPostgresError.m | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Frameworks/PostgresKit/Source/PGPostgresError.m b/Frameworks/PostgresKit/Source/PGPostgresError.m index bbf40fa1..6d0300eb 100644 --- a/Frameworks/PostgresKit/Source/PGPostgresError.m +++ b/Frameworks/PostgresKit/Source/PGPostgresError.m @@ -110,7 +110,9 @@ */ - (NSString *)_extractErrorField:(int)field fromResult:(const PGresult *)result { - return [[[NSString alloc] initWithUTF8String:PQresultErrorField(result, field)] autorelease]; + const char *error = PQresultErrorField(result, field); + + return error ? [[[NSString alloc] initWithUTF8String:error] autorelease] : nil; } #pragma mark - |