From fad83eb12adff9676396738d0f7415254a8d31b4 Mon Sep 17 00:00:00 2001 From: erichuyuehu Date: Tue, 22 Aug 2023 14:12:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=BF=AB=E6=89=8B?= =?UTF-8?q?=E9=97=AA=E9=80=80=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MSDKDns/CacheManager/MSDKDnsManager.m | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/MSDKDns/CacheManager/MSDKDnsManager.m b/MSDKDns/CacheManager/MSDKDnsManager.m index 7822b6f..0f028bb 100644 --- a/MSDKDns/CacheManager/MSDKDnsManager.m +++ b/MSDKDns/CacheManager/MSDKDnsManager.m @@ -1155,14 +1155,9 @@ - (void)detectHttpDnsServers { } - (NSString *)currentDnsServer { - // int index = self.serverIndex; - // if (index < [[[MSDKDnsParamsManager shareInstance] msdkDnsGetServerIps] count]) { - // return [[[MSDKDnsParamsManager shareInstance] msdkDnsGetServerIps] objectAtIndex:index]; - // } - // return [[MSDKDnsParamsManager shareInstance] msdkDnsGetMDnsIp]; int index = self.serverIndex; - if (index < [self.dnsServers count]) { - return [self.dnsServers objectAtIndex:index]; + if (self.dnsServers != nil && [self.dnsServers count] > 0 && index >= 0 && index < [self.dnsServers count]) { + return self.dnsServers[index]; } return [[self defaultServers] firstObject]; }