aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Source/PGPostgresError.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-01-16 20:42:19 +0000
committerstuconnolly <stuart02@gmail.com>2013-01-16 20:42:19 +0000
commitc2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3 (patch)
treecac953a322f14b4ce8bfbbee92d545db4b3a7e90 /Frameworks/PostgresKit/Source/PGPostgresError.m
parent7aa53f9496cab4625806ca38fad65d0ef6c93452 (diff)
downloadsequelpro-c2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3.tar.gz
sequelpro-c2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3.tar.bz2
sequelpro-c2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3.zip
PostgresKit: When extracting an error field check it's not null before returning it.
Diffstat (limited to 'Frameworks/PostgresKit/Source/PGPostgresError.m')
-rw-r--r--Frameworks/PostgresKit/Source/PGPostgresError.m4
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 -