From f7a00cfa5154c803bd24855a5ced9c09d1fd7cba Mon Sep 17 00:00:00 2001 From: Tyler Stromberg Date: Thu, 15 Mar 2012 00:23:37 -0400 Subject: [PATCH] Check in AFJSONDecode as well --- AFNetworking/AFJSONUtilities.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/AFNetworking/AFJSONUtilities.m b/AFNetworking/AFJSONUtilities.m index 83bb849..b7bb02f 100644 --- a/AFNetworking/AFJSONUtilities.m +++ b/AFNetworking/AFJSONUtilities.m @@ -142,7 +142,9 @@ id AFJSONDecode(NSData *data, NSError **error) { NSUInteger parseOptionFlags = 0; [invocation setArgument:&parseOptionFlags atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - [invocation setArgument:error atIndex:3]; + if (error != NULL) { + [invocation setArgument:error atIndex:3]; + } [invocation invoke]; [invocation getReturnValue:&JSON]; @@ -162,7 +164,9 @@ id AFJSONDecode(NSData *data, NSError **error) { NSUInteger yajlParserOptions = 0; [invocation setArgument:&yajlParserOptions atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - [invocation setArgument:error atIndex:3]; + if (error != NULL) { + [invocation setArgument:error atIndex:3]; + } [invocation invoke]; [invocation getReturnValue:&JSON]; @@ -173,7 +177,9 @@ id AFJSONDecode(NSData *data, NSError **error) { invocation.selector = _NXJsonParserSelector; [invocation setArgument:&data atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - [invocation setArgument:error atIndex:3]; + if (error != NULL) { + [invocation setArgument:error atIndex:3]; + } [invocation setArgument:&nullOption atIndex:4]; [invocation invoke]; @@ -189,7 +195,9 @@ id AFJSONDecode(NSData *data, NSError **error) { [invocation setArgument:&data atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation NSUInteger readOptions = 0; [invocation setArgument:&readOptions atIndex:3]; - [invocation setArgument:error atIndex:4]; + if (error != NULL) { + [invocation setArgument:error atIndex:4]; + } [invocation invoke]; [invocation getReturnValue:&JSON];