diff --git a/SDWebImage/UIView+WebCacheOperation.m b/SDWebImage/UIView+WebCacheOperation.m index 7742473c..a515a74f 100644 --- a/SDWebImage/UIView+WebCacheOperation.m +++ b/SDWebImage/UIView+WebCacheOperation.m @@ -31,8 +31,10 @@ typedef NSMutableDictionary SDOperationsDictionary; - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { if (key) { [self sd_cancelImageLoadOperationWithKey:key]; - SDOperationsDictionary *operationDictionary = [self operationDictionary]; - operationDictionary[key] = operation; + if (operation) { + SDOperationsDictionary *operationDictionary = [self operationDictionary]; + operationDictionary[key] = operation; + } } }