null判断

This commit is contained in:
陈国伟 2021-07-20 09:50:27 +08:00
parent f749200bfd
commit 7f5cad38ec

View File

@ -94,10 +94,13 @@ namespace FastGithub.ReverseProxy
{
if (subject is IList list)
{
var type = (int)list[0]!;
if (type == 2) // DNS
if (list.Count >= 2 && list[0] is int nameType && nameType == 2)
{
yield return list[list.Count - 1]!.ToString()!;
var dnsName = list[1]?.ToString();
if(dnsName!=null)
{
yield return dnsName;
}
}
}
}