aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 -