Skip to content

Commit 854d482

Browse files
committed
Fix racy modification of NotFoundHandler.
1 parent 0ef595e commit 854d482

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mux.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
8787
setCurrentRoute(req, match.Route)
8888
}
8989
if handler == nil {
90-
if r.NotFoundHandler == nil {
91-
r.NotFoundHandler = http.NotFoundHandler()
92-
}
9390
handler = r.NotFoundHandler
91+
if handler == nil {
92+
handler = http.NotFoundHandler()
93+
}
9494
}
9595
if !r.KeepContext {
9696
defer context.Clear(req)

0 commit comments

Comments
 (0)