Made sure we don't crash here if the operation is nil at some point

This commit is contained in:
Bogdan Poplauschi 2016-09-30 15:27:31 +03:00
parent 0c47bc3023
commit a8ad2a5c4a
1 changed files with 4 additions and 2 deletions

View File

@ -31,10 +31,12 @@ typedef NSMutableDictionary<NSString *, id> SDOperationsDictionary;
- (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key {
if (key) { if (key) {
[self sd_cancelImageLoadOperationWithKey:key]; [self sd_cancelImageLoadOperationWithKey:key];
if (operation) {
SDOperationsDictionary *operationDictionary = [self operationDictionary]; SDOperationsDictionary *operationDictionary = [self operationDictionary];
operationDictionary[key] = operation; operationDictionary[key] = operation;
} }
} }
}
- (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key {
// Cancel in progress downloader from queue // Cancel in progress downloader from queue