Fix the logic in SDAnimatedImage to detect scale from file path. Should not limit any path length

This commit is contained in:
DreamPiggy 2020-09-04 16:36:30 +08:00
parent f45c0441fd
commit 4f10e79f05
1 changed files with 1 additions and 3 deletions

View File

@ -25,9 +25,7 @@ static CGFloat SDImageScaleFromPath(NSString *string) {
NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:@"@[0-9]+\\.?[0-9]*x$" options:NSRegularExpressionAnchorsMatchLines error:nil];
[pattern enumerateMatchesInString:name options:kNilOptions range:NSMakeRange(0, name.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
if (result.range.location >= 3) {
scale = [string substringWithRange:NSMakeRange(result.range.location + 1, result.range.length - 2)].doubleValue;
}
scale = [string substringWithRange:NSMakeRange(result.range.location + 1, result.range.length - 2)].doubleValue;
}];
return scale;