Fix crash when performing an import with a nil keyPath mapping

This commit is contained in:
Blake Watters
2012-08-31 16:18:52 -04:00
parent 48802c09da
commit a59ced28a5

View File

@@ -182,6 +182,9 @@
- (NSUInteger)importObjectsFromFileAtPath:(NSString *)path withMapping:(RKMapping *)mapping keyPath:(NSString *)keyPath error:(NSError **)error
{
NSParameterAssert(path);
NSParameterAssert(mapping);
// Perform the reset on the first import action if requested
[self resetPersistentStoreIfNecessary];
@@ -203,7 +206,7 @@
return NSNotFound;
}
NSDictionary *mappingDictionary = @{ keyPath: mapping };
NSDictionary *mappingDictionary = @{ (keyPath ?: [NSNull null]) : mapping };
RKObjectMapper *mapper = [[RKObjectMapper alloc] initWithObject:parsedData mappingsDictionary:mappingDictionary];
mapper.mappingOperationDataSource = self.mappingOperationDataSource;
__block RKMappingResult *mappingResult;