From 691873117a21143da877d7ad48d350b2362571a8 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 2 Apr 2019 16:32:15 +0800 Subject: [PATCH] Fix the logic to check loaders. Find the correct loader first and then check if optional protocol method is implemented --- SDWebImage/SDImageLoadersManager.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SDWebImage/SDImageLoadersManager.m b/SDWebImage/SDImageLoadersManager.m index dd99c31c..680b9a7a 100644 --- a/SDWebImage/SDImageLoadersManager.m +++ b/SDWebImage/SDImageLoadersManager.m @@ -103,11 +103,12 @@ - (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error { NSArray> *loaders = self.loaders; for (id loader in loaders.reverseObjectEnumerator) { - if (![loader respondsToSelector:@selector(shouldBlockFailedURLWithURL:error:)]) { - break; - } if ([loader canRequestImageForURL:url]) { - return [loader shouldBlockFailedURLWithURL:url error:error]; + if ([loader respondsToSelector:@selector(shouldBlockFailedURLWithURL:error:)]) { + return [loader shouldBlockFailedURLWithURL:url error:error]; + } else { + return NO; + } } } return NO;