Skip to content

Commit b25864c

Browse files
committed
Fix the issue when multiple request for same url failed, the completedBlock will callback more times
1 parent 9cf8d12 commit b25864c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

SDWebImage/Core/SDWebImageDownloaderOperation.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didComp
601601
CGSize imageSize = image.size;
602602
if (imageSize.width == 0 || imageSize.height == 0) {
603603
NSString *description = image == nil ? @"Downloaded image decode failed" : @"Downloaded image has 0 pixels";
604-
[self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : description}]];
604+
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : description}];
605+
[self callCompletionBlockWithToken:token image:nil imageData:nil error:error finished:YES];
605606
} else {
606607
[self callCompletionBlockWithToken:token image:image imageData:imageData error:nil finished:YES];
607608
}

0 commit comments

Comments
 (0)