diff --git a/SDWebImage/UIButton+WebCache.m b/SDWebImage/UIButton+WebCache.m index c678ed0b..7c861e81 100644 --- a/SDWebImage/UIButton+WebCache.m +++ b/SDWebImage/UIButton+WebCache.m @@ -71,11 +71,10 @@ static inline NSString * backgroundImageURLKeyForState(UIControlState state) { completed:(nullable SDExternalCompletionBlock)completedBlock { if (!url) { [self.imageURLStorage removeObjectForKey:imageURLKeyForState(state)]; - return; + } else { + self.imageURLStorage[imageURLKeyForState(state)] = url; } - self.imageURLStorage[imageURLKeyForState(state)] = url; - __weak typeof(self)weakSelf = self; [self sd_internalSetImageWithURL:url placeholderImage:placeholder @@ -131,11 +130,10 @@ static inline NSString * backgroundImageURLKeyForState(UIControlState state) { completed:(nullable SDExternalCompletionBlock)completedBlock { if (!url) { [self.imageURLStorage removeObjectForKey:backgroundImageURLKeyForState(state)]; - return; + } else { + self.imageURLStorage[backgroundImageURLKeyForState(state)] = url; } - self.imageURLStorage[backgroundImageURLKeyForState(state)] = url; - __weak typeof(self)weakSelf = self; [self sd_internalSetImageWithURL:url placeholderImage:placeholder