Skip to content

Commit c9df9a0

Browse files
authored
Fix (#8868)
1 parent 56f1794 commit c9df9a0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,11 @@ private void GenDnsProtectCustom()
433433
localDnsServer.tag = tag;
434434

435435
dns4Sbox.servers.Add(localDnsServer);
436-
dns4Sbox.rules.Insert(0, BuildProtectDomainRule());
436+
var protectDomainRule = BuildProtectDomainRule();
437+
if (protectDomainRule != null)
438+
{
439+
dns4Sbox.rules.Insert(0, protectDomainRule);
440+
}
437441

438442
_coreConfig.dns = dns4Sbox;
439443
}
@@ -455,8 +459,12 @@ private void GenDnsProtectCustomLegacy()
455459
_coreConfig.dns?.servers?.Add(localDnsServer);
456460
}
457461

458-
private Rule4Sbox BuildProtectDomainRule()
462+
private Rule4Sbox? BuildProtectDomainRule()
459463
{
464+
if (context.ProtectDomainList.Count == 0)
465+
{
466+
return null;
467+
}
460468
return new()
461469
{
462470
server = Global.SingboxLocalDNSTag,

0 commit comments

Comments
 (0)