From 854d482e26505d59549690719cbc009f04042c2e Mon Sep 17 00:00:00 2001 From: Kamil Kisiel Date: Wed, 4 Jun 2014 14:12:38 -0700 Subject: [PATCH] Fix racy modification of NotFoundHandler. --- mux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mux.go b/mux.go index 8b23c39..5b5f8e7 100644 --- a/mux.go +++ b/mux.go @@ -87,10 +87,10 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { setCurrentRoute(req, match.Route) } if handler == nil { - if r.NotFoundHandler == nil { - r.NotFoundHandler = http.NotFoundHandler() - } handler = r.NotFoundHandler + if handler == nil { + handler = http.NotFoundHandler() + } } if !r.KeepContext { defer context.Clear(req)