Skip to content

Commit

Permalink
Change the && to || so that if the receiver is not the default or roo…
Browse files Browse the repository at this point in the history
…tSaving contexts, the completion handler will still be run.

Also added a return; on the initial IF statement so that the completion handler does not get run twice as would be the case if the context was the MR_defaultContext.
  • Loading branch information
ChronicStim committed Jul 9, 2012
1 parent 777cbc3 commit 9164aad
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -104,9 +104,10 @@ - (void) MR_saveInBackgroundErrorHandler:(void (^)(NSError *))errorCallback comp
if (self == [[self class] MR_defaultContext])
{
[[[self class] MR_rootSavingContext] MR_saveInBackgroundErrorHandler:errorCallback completion:completion];
return;
}

if (completion && self == [[self class] MR_rootSavingContext])
if (completion || self == [[self class] MR_rootSavingContext])
{
dispatch_async(dispatch_get_main_queue(), completion);
}
Expand Down

0 comments on commit 9164aad

Please sign in to comment.