Browse Source

fix cli shutdown panic

fancl 9 months ago
parent
commit
b28dbdb8c1
1 changed files with 3 additions and 1 deletions
  1. 3 1
      entry/cli/server.go

+ 3 - 1
entry/cli/server.go

@@ -210,7 +210,9 @@ func (svr *Server) Shutdown() (err error) {
 	if !atomic.CompareAndSwapInt32(&svr.exitFlag, 0, 1) {
 		return
 	}
-	err = svr.l.Close()
+	if svr.l != nil {
+		err = svr.l.Close()
+	}
 	svr.ctxMap.Range(func(key, value any) bool {
 		if ctx, ok := value.(*Context); ok {
 			err = ctx.Close()