mirror of
https://github.com/svga/SVGAPlayer-iOS.git
synced 2025-10-20 23:19:13 +08:00
fix: Avoid URL == nil crash.
This commit is contained in:
@@ -34,9 +34,17 @@ static NSOperationQueue *unzipQueue;
|
||||
- (void)parseWithURL:(nonnull NSURL *)URL
|
||||
completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock
|
||||
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock {
|
||||
[self parseWithURLRequest:[NSURLRequest requestWithURL:URL cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:20.0]
|
||||
completionBlock:completionBlock
|
||||
failureBlock:failureBlock];
|
||||
if (URL != nil) {
|
||||
[self parseWithURLRequest:[NSURLRequest requestWithURL:URL cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:20.0]
|
||||
completionBlock:completionBlock
|
||||
failureBlock:failureBlock];
|
||||
} else {
|
||||
if (failureBlock) {
|
||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
||||
failureBlock([NSError errorWithDomain:@"SVGAParser" code:404 userInfo:@{NSLocalizedDescriptionKey: @"URL cannot be nil."}]);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)parseWithURLRequest:(NSURLRequest *)URLRequest completionBlock:(void (^)(SVGAVideoEntity * _Nullable))completionBlock failureBlock:(void (^)(NSError * _Nullable))failureBlock {
|
||||
|
Reference in New Issue
Block a user