mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Fix for crash when coercing an empty object mapping result set into a singular result with asObject. closes #190
This commit is contained in:
@@ -52,11 +52,14 @@
|
||||
|
||||
- (id)asObject {
|
||||
NSArray* collection = [self asCollection];
|
||||
if ([collection count] > 1) {
|
||||
NSUInteger count = [collection count];
|
||||
if (count > 1) {
|
||||
RKLogWarning(@"Coerced object mapping result containing %d objects into singular result.", [collection count]);
|
||||
} else if (count == 1) {
|
||||
return [collection objectAtIndex:0];
|
||||
}
|
||||
|
||||
return [collection objectAtIndex:0];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSError*)asError {
|
||||
|
||||
Reference in New Issue
Block a user