DNSResolver: Bugfix: Always call completion handler

This commit is contained in:
Roopesh Chander 2018-11-02 18:10:51 +05:30
parent c04773276a
commit 8fee05969e
1 changed files with 4 additions and 1 deletions

View File

@ -53,7 +53,10 @@ class DNSResolver {
dispatchGroup.notify(queue: .main) {
assert(endpoints.count == resolvedEndpoints.count)
for (i, endpoint) in endpoints.enumerated() {
guard let endpoint = endpoint, let resolvedEndpoint = resolvedEndpoints[i] else { return }
guard let endpoint = endpoint, let resolvedEndpoint = resolvedEndpoints[i] else {
completionHandler(nil)
return
}
if (isResolvedByDNSRequest[i]) {
DNSResolver.cache.setObject(resolvedEndpoint.stringRepresentation() as NSString,
forKey: endpoint.stringRepresentation() as NSString)