From f388740276d790ac03eb5953c0b654358a7a8ea0 Mon Sep 17 00:00:00 2001 From: Andrew Vyazovoy Date: Fri, 31 May 2013 11:16:03 -0700 Subject: [PATCH] [Issue #1025] Adding check for nil responseString in responseJSON Signed-off-by: Mattt Thompson --- AFNetworking/AFJSONRequestOperation.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFNetworking/AFJSONRequestOperation.m b/AFNetworking/AFJSONRequestOperation.m index 27d3b6d..1f0a28f 100644 --- a/AFNetworking/AFJSONRequestOperation.m +++ b/AFNetworking/AFJSONRequestOperation.m @@ -70,7 +70,7 @@ static dispatch_queue_t json_request_operation_processing_queue() { // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization. // See https://github.com/rails/rails/issues/1742 - if ([self.responseData length] == 0 || [self.responseString isEqualToString:@" "]) { + if ([self.responseData length] == 0 || !self.responseString || [self.responseString isEqualToString:@" "]) { self.responseJSON = nil; } else { // Workaround for a bug in NSJSONSerialization when Unicode character escape codes are used instead of the actual character