From 820f13ec935ae6510cbb5471dd621ea5fe931ca8 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 17 Jul 2018 17:51:23 +0800 Subject: [PATCH] Fix nullable key when get image load operation --- SDWebImage/UIView+WebCacheOperation.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SDWebImage/UIView+WebCacheOperation.m b/SDWebImage/UIView+WebCacheOperation.m index d83c8e0c..5be2b03e 100644 --- a/SDWebImage/UIView+WebCacheOperation.m +++ b/SDWebImage/UIView+WebCacheOperation.m @@ -31,9 +31,11 @@ typedef NSMapTable> SDOperationsDictionary; - (nullable id)sd_imageLoadOperationForKey:(nullable NSString *)key { id operation; - SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; - @synchronized (self) { - operation = [operationDictionary objectForKey:key]; + if (key) { + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + @synchronized (self) { + operation = [operationDictionary objectForKey:key]; + } } return operation; }