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,8 +31,10 @@ typedef NSMutableDictionary<NSString *, id> 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;
}
}
}