Fix crash in exchangeParallel

This commit is contained in:
世界 2025-02-10 14:32:33 +08:00
parent 7500b699e5
commit cb17c08db8
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -86,9 +86,11 @@ func (t *Transport) exchangeParallel(ctx context.Context, systemConfig *dnsConfi
results := make(chan queryResult)
startRacer := func(ctx context.Context, fqdn string) {
response, err := t.tryOneName(ctx, systemConfig, fqdn, message)
addresses, _ := dns.MessageToAddresses(response)
if len(addresses) == 0 {
err = E.New(fqdn, ": empty result")
if err == nil {
addresses, _ := dns.MessageToAddresses(response)
if len(addresses) == 0 {
err = E.New(fqdn, ": empty result")
}
}
select {
case results <- queryResult{response, err}: