Guard against a potential "Could not fulfill a fault" crash during relationship connection if the object being connected has been deleted before the operation executes

This commit is contained in:
Blake Watters
2013-02-04 11:08:55 -05:00
parent 7c9264025f
commit 79150ad51e
2 changed files with 3 additions and 3 deletions

View File

@@ -45,8 +45,8 @@
@return The receiver, initialized with the given managed object, connection mapping, and managed object cache.
*/
- (id)initWithManagedObject:(NSManagedObject *)managedObject
connection:(RKConnectionDescription *)connection
managedObjectCache:(id<RKManagedObjectCaching>)managedObjectCache;
connection:(RKConnectionDescription *)connection
managedObjectCache:(id<RKManagedObjectCaching>)managedObjectCache;
///--------------------------------------------
/// @name Accessing Details About the Operation

View File

@@ -181,7 +181,7 @@ static NSDictionary *RKConnectionAttributeValuesWithObject(RKConnectionDescripti
- (void)main
{
if (self.isCancelled) return;
if (self.isCancelled || [self.managedObject isDeleted]) return;
NSString *relationshipName = self.connection.relationship.name;
RKLogTrace(@"Connecting relationship '%@' with mapping: %@", relationshipName, self.connection);
[self.managedObjectContext performBlockAndWait:^{