Skip to content

Commit 9fc0703

Browse files
committed
Fix crash when attempting to connect a one-to-one relationship that returns an empty result set
1 parent 4eb765a commit 9fc0703

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Code/CoreData/RKRelationshipConnectionOperation.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ - (id)findConnected
148148
connectionResult = managedObjects;
149149
} else {
150150
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]);
151+
if ([managedObjects count]) connectionResult = managedObjects[0];
151152
}
152153
} else if ([self.connection isKeyPathConnection]) {
153154
connectionResult = [self.managedObject valueForKeyPath:self.connection.keyPath];

0 commit comments

Comments
 (0)