fix nil ptr

This commit is contained in:
Денис Евстигнеев 2024-03-12 16:44:34 +03:00
parent c3e6cdd973
commit 5e6bd93a6b
1 changed files with 2 additions and 0 deletions

View File

@ -562,6 +562,8 @@ func (h *Server) Start() error {
var ok bool
if hs, ok = h.opts.Context.Value(serverKey{}).(*http.Server); ok && hs != nil {
hs.Handler = fn
} else {
hs = &http.Server{Handler: fn}
}
}