From 13bd601cac17ec792c40b84fc91ebc849dea59bb Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Mon, 11 Oct 2021 21:05:38 +0800 Subject: [PATCH] Fix: #1660 panic --- dns/doh.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dns/doh.go b/dns/doh.go index 3daa7f22..94312355 100644 --- a/dns/doh.go +++ b/dns/doh.go @@ -39,7 +39,9 @@ func (dc *dohClient) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, req = req.WithContext(ctx) msg, err = dc.doRequest(req) - msg.Id = m.Id + if err == nil { + msg.Id = m.Id + } return }