From b28dbdb8c10bec7e93a90e1ed9b469ec8e4ace9b Mon Sep 17 00:00:00 2001 From: fancl Date: Fri, 14 Jun 2024 11:32:20 +0800 Subject: [PATCH] fix cli shutdown panic --- entry/cli/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entry/cli/server.go b/entry/cli/server.go index 18ed174..5bee47c 100644 --- a/entry/cli/server.go +++ b/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()