fix nil dereference: check that httpServer is set before shutting down (#1893)

This commit is contained in:
mmetc 2022-11-28 11:55:08 +01:00 committed by GitHub
parent aa974d26c6
commit 66543493b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -349,8 +349,10 @@ func (s *APIServer) Close() {
func (s *APIServer) Shutdown() error {
s.Close()
if err := s.httpServer.Shutdown(context.TODO()); err != nil {
return err
if s.httpServer != nil {
if err := s.httpServer.Shutdown(context.TODO()); err != nil {
return err
}
}
//close io.writer logger given to gin