fix nil dereference: check that httpServer is set before shutting down (#1893)
This commit is contained in:
parent
aa974d26c6
commit
66543493b5
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue