core: add nil check
Check if msg is nil in DefaultErrorFunc. If this is the case log this
and short cut the function.
Hoping to get more insight in
@@ -289,6 +289,12 @@ func DefaultErrorFunc(w dns.ResponseWriter, r *dns.Msg, rc int) {
answer := new(dns.Msg)
answer.SetRcode(r, rc)
+ if r == nil {
+ log.Printf("[WARNING] DefaultErrorFunc called with nil *dns.Msg (Remote: %s)", w.RemoteAddr().String())
+ w.WriteMsg(answer)
+ return
+ }
+
state.SizeAndDo(answer)
vars.Report(state, vars.Dropped, rcode.ToString(rc), answer.Len(), time.Now())
