Skip to content

Commit 77f938d

Browse files
committed
Fix condition location
Signed-off-by: AliveDevil <[email protected]>
1 parent c8b224b commit 77f938d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

alternate.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ func (f Alternate) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Ms
5757
rulesIndex := rcode
5858
if nw.Msg != nil {
5959
rulesIndex = nw.Msg.Rcode
60-
}
61-
62-
// if rcode is SUCCESS, and no answer is given, use RcodeNoData as hint for negative response.
63-
if rulesIndex == dns.RcodeSuccess && isEmpty(r) {
64-
rulesIndex = RcodeNoData
60+
if rulesIndex == dns.RcodeSuccess && isEmpty(nw.Msg) {
61+
// if rcode is SUCCESS, and no answer is given, use RcodeNoData as hint for negative response.
62+
rulesIndex = RcodeNoData
63+
}
6564
}
6665

6766
if u, ok := f.rules[rulesIndex]; ok {

0 commit comments

Comments
 (0)