diff --git a/internal/connect/tcp_server.go b/internal/connect/tcp_server.go index 04d630a..35fb872 100644 --- a/internal/connect/tcp_server.go +++ b/internal/connect/tcp_server.go @@ -55,7 +55,7 @@ func (*handler) OnMessage(c *gn.Conn, bytes []byte) { func (*handler) OnClose(c *gn.Conn, err error) { conn, ok := c.GetData().(*Conn) - if !ok { + if !ok || conn == nil { return } logger.Logger.Debug("close", zap.String("addr", c.GetAddr()), zap.Int64("user_id", conn.UserId),