Commit 86816a95 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

thumbnail cache: fix another potential runtime exception

parent 435494e6
...@@ -196,11 +196,12 @@ static NSCache *_thumbnailCacheMetadata; ...@@ -196,11 +196,12 @@ static NSCache *_thumbnailCacheMetadata;
} }
UIGraphicsBeginImageContext(imageSize); UIGraphicsBeginImageContext(imageSize);
for (NSUInteger i = 0; i < fileNumber; i++) { NSUInteger iter = files.count < fileNumber ? files.count : fileNumber;
for (NSUInteger i = 0; i < iter; i++) {
MLFile *file = [files objectAtIndex:i]; MLFile *file = [files objectAtIndex:i];
clusterThumb = [VLCThumbnailsCache thumbnailForMediaFile:file]; clusterThumb = [VLCThumbnailsCache thumbnailForMediaFile:file];
CGContextRef context = UIGraphicsGetCurrentContext(); CGContextRef context = UIGraphicsGetCurrentContext();
CGFloat imagePartWidth = (imageSize.width / fileNumber); CGFloat imagePartWidth = (imageSize.width / iter);
//the rect in which the image should be drawn //the rect in which the image should be drawn
CGRect clippingRect = CGRectMake(imagePartWidth * i, 0, imagePartWidth, imageSize.height); CGRect clippingRect = CGRectMake(imagePartWidth * i, 0, imagePartWidth, imageSize.height);
CGContextSaveGState(context); CGContextSaveGState(context);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment