fix nil ptr
This commit is contained in:
parent
c3e6cdd973
commit
5e6bd93a6b
2
http.go
2
http.go
@ -562,6 +562,8 @@ func (h *Server) Start() error {
|
|||||||
var ok bool
|
var ok bool
|
||||||
if hs, ok = h.opts.Context.Value(serverKey{}).(*http.Server); ok && hs != nil {
|
if hs, ok = h.opts.Context.Value(serverKey{}).(*http.Server); ok && hs != nil {
|
||||||
hs.Handler = fn
|
hs.Handler = fn
|
||||||
|
} else {
|
||||||
|
hs = &http.Server{Handler: fn}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user