From a8ad2a5c4abbeec6f6b4690897c412304d0b0cf7 Mon Sep 17 00:00:00 2001 From: Bogdan Poplauschi Date: Fri, 30 Sep 2016 15:27:31 +0300 Subject: [PATCH] Made sure we don't crash here if the operation is nil at some point --- SDWebImage/UIView+WebCacheOperation.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; + } } }