Fix issue where progress block is [NSNull null] and that tries to be executed

This commit is contained in:
Matt Galloway 2015-01-08 22:09:35 +00:00
parent a02aa42256
commit 91fcbb635c
1 changed files with 4 additions and 2 deletions

View File

@ -79,9 +79,11 @@ static NSString *const kCompletedCallbackKey = @"completed";
}
- (NSArray *)callbacksForKey:(NSString *)key {
__block NSArray *callbacks = nil;
__block NSMutableArray *callbacks = nil;
dispatch_sync(self.barrierQueue, ^{
callbacks = [self.callbackBlocks valueForKey:key];
// We need to remove [NSNull null] because there might not always be a progress block for each callback
callbacks = [[self.callbackBlocks valueForKey:key] mutableCopy];
[callbacks removeObjectIdenticalTo:[NSNull null]];
});
return callbacks;
}