From 9fc0703d2196fbcf774d44084243273fb237eca3 Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Thu, 29 Nov 2012 00:22:42 -0500 Subject: [PATCH] Fix crash when attempting to connect a one-to-one relationship that returns an empty result set --- Code/CoreData/RKRelationshipConnectionOperation.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Code/CoreData/RKRelationshipConnectionOperation.m b/Code/CoreData/RKRelationshipConnectionOperation.m index 420d2d64..f8416931 100644 --- a/Code/CoreData/RKRelationshipConnectionOperation.m +++ b/Code/CoreData/RKRelationshipConnectionOperation.m @@ -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];