mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-01-12 22:51:50 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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:^{
|
||||
|
||||
Reference in New Issue
Block a user