Skip to content

Commit

Permalink
Merge pull request #1439 from Moral-Piggy/master
Browse files Browse the repository at this point in the history
Without creating a NSError instance when completedBlock is nil
  • Loading branch information
bpoplauschi committed Jan 20, 2016
2 parents a8fca65 + 47115e2 commit 9ecf488
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion SDWebImage/UIButton+WebCache.m
Expand Up @@ -57,8 +57,8 @@ - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placehold
[self.imageURLStorage removeObjectForKey:@(state)];

dispatch_main_async_safe(^{
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
if (completedBlock) {
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
completedBlock(nil, error, SDImageCacheTypeNone, url);
}
});
Expand Down
2 changes: 1 addition & 1 deletion SDWebImage/UIImageView+WebCache.m
Expand Up @@ -87,8 +87,8 @@ - (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder
} else {
dispatch_main_async_safe(^{
[self removeActivityIndicator];
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
if (completedBlock) {
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
completedBlock(nil, error, SDImageCacheTypeNone, url);
}
});
Expand Down

0 comments on commit 9ecf488

Please sign in to comment.