Fix the clang analyze issue

This commit is contained in:
DreamPiggy 2022-07-16 19:43:48 +08:00
parent d0f3c39335
commit 0757241822
2 changed files with 3 additions and 6 deletions

View File

@ -552,11 +552,6 @@ static id<SDImageLoader> _defaultImageLoader;
cacheType:(SDImageCacheType)cacheType
finished:(BOOL)finished
completed:(nullable SDInternalCompletionBlock)completedBlock {
// the target image store cache type
SDImageCacheType storeCacheType = SDImageCacheTypeAll;
if (context[SDWebImageContextStoreCacheType]) {
storeCacheType = [context[SDWebImageContextStoreCacheType] integerValue];
}
id<SDImageTransformer> transformer = context[SDWebImageContextImageTransformer];
if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) {
transformer = nil;
@ -661,7 +656,7 @@ static id<SDImageLoader> _defaultImageLoader;
BOOL shouldThumbnailImage = context[SDWebImageContextImageThumbnailPixelSize] != nil || image.sd_decodeOptions[SDImageCoderDecodeThumbnailPixelSize] != nil;
// Store the transformed/thumbnail image into the cache
if (transformed || shouldThumbnailImage) {
if (image && (transformed || shouldThumbnailImage)) {
NSData *cacheData;
// pass nil if the image was transformed/thumbnailed, so we can recalculate the data from the image
if (cacheSerializer && (storeCacheType == SDImageCacheTypeDisk || storeCacheType == SDImageCacheTypeAll)) {

View File

@ -576,6 +576,8 @@ static inline CGImageRef _Nullable SDCreateCGImageFromCIImage(CIImage * _Nonnull
return SDGetColorFromRGBA(pixel, bitmapInfo);
} else {
NSLog(@"Unsupported components: %zu", components);
CFRelease(data);
CGImageRelease(imageRef);
return nil;
}
}