From ebf41a3b0107a768845d0352b1c5212503d07c03 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 19 Mar 2019 20:26:00 +0800 Subject: [PATCH] Consolidate cancel code --- SDWebImage/SDWebImagePrefetcher.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SDWebImage/SDWebImagePrefetcher.m b/SDWebImage/SDWebImagePrefetcher.m index ddf532e7..c40055ec 100644 --- a/SDWebImage/SDWebImagePrefetcher.m +++ b/SDWebImage/SDWebImagePrefetcher.m @@ -263,8 +263,9 @@ @synchronized (self) { [self.prefetchOperations compact]; for (id operation in self.prefetchOperations) { - SDAsyncBlockOperation *asyncBlockOperation = operation; - [asyncBlockOperation cancel]; + if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) { + [operation cancel]; + } } self.prefetchOperations.count = 0;