Removed creation of NSError when a nil URL is downloaded.

This commit is contained in:
Reid Main 2013-01-16 22:22:33 -05:00
parent b59b42e6b5
commit 599636fa58
1 changed files with 2 additions and 3 deletions

View File

@ -144,13 +144,12 @@ static NSString *const kCompletedCallbackKey = @"completed";
- (void)addProgressCallback:(void (^)(NSUInteger, long long))progressBlock andCompletedBlock:(void (^)(UIImage *, NSData *data, NSError *, BOOL))completedBlock forURL:(NSURL *)url createCallback:(void (^)())createCallback
{
// The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data and an error.
// The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data.
if(url == nil)
{
if (completedBlock != nil)
{
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:0 userInfo:@{NSLocalizedDescriptionKey: @"Could not load an image because URL was nil."}];
completedBlock(nil, nil, error, NO);
completedBlock(nil, nil, nil, NO);
}
return;
}