diff --git a/AFNetworking/AFJSONUtilities.m b/AFNetworking/AFJSONUtilities.m index 51241cf..b7bb02f 100644 --- a/AFNetworking/AFJSONUtilities.m +++ b/AFNetworking/AFJSONUtilities.m @@ -48,7 +48,9 @@ NSData * AFJSONEncode(id object, NSError **error) { NSUInteger serializeOptionFlags = 0; [invocation setArgument:&serializeOptionFlags 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:&data]; @@ -99,7 +101,9 @@ NSData * AFJSONEncode(id object, NSError **error) { [invocation setArgument:&object atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation NSUInteger writeOptions = 0; [invocation setArgument:&writeOptions atIndex:3]; - [invocation setArgument:error atIndex:4]; + if (error != NULL) { + [invocation setArgument:error atIndex:4]; + } [invocation invoke]; [invocation getReturnValue:&data]; @@ -138,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]; @@ -158,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]; @@ -169,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]; @@ -185,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];