Fixed #1583 crash in `SDWebImageManager cacheKeyForURL:` when url is nil - replaced #1585

This commit is contained in:
Bogdan Poplauschi 2016-06-06 07:32:34 +03:00
parent d8dc6a25aa
commit 1bf62d475a
1 changed files with 5 additions and 2 deletions

View File

@ -54,10 +54,13 @@
}
- (NSString *)cacheKeyForURL:(NSURL *)url {
if (!url) {
return @"";
}
if (self.cacheKeyFilter) {
return self.cacheKeyFilter(url);
}
else {
} else {
if (NSClassFromString(@"NSURLComponents") && [NSURLComponents instancesRespondToSelector:@selector(string)]) {
NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithURL:url resolvingAgainstBaseURL:NO];
urlComponents.query = nil; // Strip out query parameters.