summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Juick/APIClient.m14
1 files changed, 9 insertions, 5 deletions
diff --git a/Juick/APIClient.m b/Juick/APIClient.m
index 3332556..4652c0c 100644
--- a/Juick/APIClient.m
+++ b/Juick/APIClient.m
@@ -253,12 +253,16 @@
NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL];
NSString *boundary = [NSString stringWithFormat:@"Boundary-%@", [[NSUUID UUID] UUIDString]];
[self fetchDataWithURL:url data:[self multipartData:params withBoundary:boundary] boundary:boundary callback:^(NSData *data, NSError *err) {
- NSError *jsonError;
- NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
- if (jsonError) {
- callback(nil, jsonError);
+ if (!err) {
+ NSError *jsonError;
+ NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
+ if (jsonError) {
+ callback(nil, jsonError);
+ } else {
+ callback(jsonData, nil);
+ }
} else {
- callback(jsonData, nil);
+ callback(nil, err);
}
}];
}