From c2d9b3fd35e64cbb307cc04fb6789dc4656f9ca3 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Wed, 16 Jan 2013 20:42:19 +0000 Subject: PostgresKit: When extracting an error field check it's not null before returning it. --- Frameworks/PostgresKit/Source/PGPostgresError.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Frameworks') 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 - -- cgit v1.2.3