From 13e6e746807cca9687f29bacde886e939a499865 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 7 Oct 2010 08:45:21 +0200 Subject: [PATCH] Fix printing of the header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch from Stéphane Bortzmeyer --- dnsmsg.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dnsmsg.go b/dnsmsg.go index 99369c5c..dd7fdeb3 100644 --- a/dnsmsg.go +++ b/dnsmsg.go @@ -480,6 +480,10 @@ type MsgHdr struct { //;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48404 //;; flags: qr aa rd ra; func (h *MsgHdr) String() string { + if h == nil { + return " MsgHdr" + } + s := ";; ->>HEADER<<- opcode: " + opcode_str[h.opcode] s += ", status: " + rcode_str[h.rcode] s += ", id: " + strconv.Itoa(int(h.id)) + "\n"