fix(backend): check that player socket exists before trying to send data

This commit is contained in:
2025-03-11 12:35:38 +01:00
parent 49e84eaac7
commit 889ee4ce4f
2 changed files with 7 additions and 0 deletions

View File

@ -64,6 +64,10 @@ func unpackData(datas []any, target interface{}) bool {
}
func verifyPlayerIsActivePlayer(room *types.Room, target *types.Player) bool {
if target.Connection.Socket == nil {
return false
}
if room.GameState != types.StateRunning {
target.Connection.Socket.Emit("Status", types.S2C_Status{
IsError: true,