Fix crash when attempting to connect a one-to-one relationship that returns an empty result set

This commit is contained in:
Blake Watters
2012-11-29 00:22:42 -05:00
parent 4eb765aad8
commit 9fc0703d21

View File

@@ -148,6 +148,7 @@ static NSDictionary *RKConnectionAttributeValuesWithObject(RKConnectionDescripti
connectionResult = managedObjects;
} else {
if ([managedObjects count] > 1) RKLogWarning(@"Retrieved %ld objects satisfying connection criteria for one-to-one relationship connection: only the first result will be connected.", (long) [managedObjects count]);
if ([managedObjects count]) connectionResult = managedObjects[0];
}
} else if ([self.connection isKeyPathConnection]) {
connectionResult = [self.managedObject valueForKeyPath:self.connection.keyPath];