From fa0297f1b85957cce3e4f8b3e1a9dda336bd5efc Mon Sep 17 00:00:00 2001 From: dstnbrkr Date: Wed, 10 Aug 2011 14:08:07 -0700 Subject: [PATCH] Call success with nil if response data has length == 0. Fixes exception when attempting to parse empty response data (i.e. HTTP Status Code 204 No Content). --- AFNetworking/AFJSONRequestOperation.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AFNetworking/AFJSONRequestOperation.m b/AFNetworking/AFJSONRequestOperation.m index f7c699c..62b66f0 100644 --- a/AFNetworking/AFJSONRequestOperation.m +++ b/AFNetworking/AFJSONRequestOperation.m @@ -61,6 +61,10 @@ if (failure) { failure(error); } + } else if ([data length] == 0) { + if (success) { + success(nil); + } } else { id JSON = nil;