From abc6edfd0a4434f07508f785097718c0162d66a3 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Tue, 31 Aug 2021 11:43:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=AAid?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=B7=BB=E5=8A=A0=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?panic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/data/data_admin.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/data/data_admin.go b/core/data/data_admin.go index 00a05ee..7a15eed 100644 --- a/core/data/data_admin.go +++ b/core/data/data_admin.go @@ -87,7 +87,10 @@ func (a *Admin) HandlerWS(funcName string, options *websocket.AcceptOptions) fun case <-client.GetCtx().Done(): c.Status(499) return - case msg := <-client.MsgChan(): + case msg, ok := <-client.MsgChan(): + if !ok { + return + } data, err := msg.Marshal() if err != nil { a.Logger.Error("Marshal error", zap.Any("err", err))