From d7089fd2a3560c6b8d733ed70d6414f2768059c5 Mon Sep 17 00:00:00 2001 From: Tyler Stromberg Date: Thu, 15 Mar 2012 00:16:28 -0400 Subject: [PATCH] Check for null error pointer before setting it on the invocation --- AFNetworking/AFJSONUtilities.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AFNetworking/AFJSONUtilities.m b/AFNetworking/AFJSONUtilities.m index 51241cf..83bb849 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];