Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix broken dynamic mapping test

  • Loading branch information...
commit d024a518a4d8594edb25c82bad07cda974ce8961 1 parent b93fe1f
@blakewatters blakewatters authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 Code/Network/RKManagedObjectRequestOperation.m
View
9 Code/Network/RKManagedObjectRequestOperation.m
@@ -163,6 +163,9 @@ - (void)visitMapping:(RKMapping *)mapping atKeyPath:(NSString *)keyPath
}
}
} else if ([mapping isKindOfClass:[RKDynamicMapping class]]) {
+ // Pop the dynamic mapping off of the stack so that our children are rooted at the same level
+ [self.visitationStack removeLastObject];
+
// Dynamic mappings appear at the same point in the graph, so we recurse with the same keyPath
for (RKMapping *nestedMapping in [(RKDynamicMapping *)mapping objectMappings]) {
[self visitMapping:nestedMapping atKeyPath:keyPath];
@@ -174,8 +177,10 @@ - (void)visitMapping:(RKMapping *)mapping atKeyPath:(NSString *)keyPath
NSNumber *indexValueForMapping = [self.index objectForKey:dictionaryKey];
if ([lowLinkValueForMapping isEqualToNumber:indexValueForMapping]) {
NSUInteger index = [self.visitationStack indexOfObject:visitation];
- NSRange removalRange = NSMakeRange(index, [self.visitationStack count] - index);
- [self.visitationStack removeObjectsInRange:removalRange];
+ if (index != NSNotFound) {
+ NSRange removalRange = NSMakeRange(index, [self.visitationStack count] - index);
+ [self.visitationStack removeObjectsInRange:removalRange];
+ }
if ([visitation.mapping isKindOfClass:[RKEntityMapping class]]) {
[self.visitations addObject:visitation];
Please sign in to comment.
Something went wrong with that request. Please try again.