From b1f185d51929cfaf4fc69242717840a564040d32 Mon Sep 17 00:00:00 2001 From: 1 <1@72wo.cn> Date: Mon, 6 Oct 2025 07:29:49 +0000 Subject: [PATCH] =?UTF-8?q?=E5=BA=95=E5=B1=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/socket/ServerEvent.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/socket/ServerEvent.go b/common/socket/ServerEvent.go index 833fad8c..50288073 100644 --- a/common/socket/ServerEvent.go +++ b/common/socket/ServerEvent.go @@ -42,12 +42,8 @@ func (s *Server) OnClose(c gnet.Conn, _ error) (action gnet.Action) { atomic.AddInt64(&s.connected, -1) //logging.Infof("conn[%v] disconnected", c.RemoteAddr().String()) v, ok := c.Context().(*player.ClientData) - if !ok { - return - } - - if v.Player != nil { + if ok && v.Player != nil { v.Player.Save() //保存玩家数据 }