Fix error when sending empty name to unnamed game update players
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
c2f8e74265
commit
62489e925f
@ -3161,18 +3161,24 @@ const sendUpdateToPlayers = async (game, update) => {
|
||||
update
|
||||
});
|
||||
for (let key in game.sessions) {
|
||||
const _session = game.sessions[key];
|
||||
const session = game.sessions[key];
|
||||
/* Only send player and game data to named players */
|
||||
if (!_session.name) {
|
||||
if (!session.name) {
|
||||
console.log(`${session.id}: -> sendUpdateToPlayers:` +
|
||||
`${getName(_session)} - only sending empty name`);
|
||||
message = JSON.stringify({ name: "" });
|
||||
`${getName(session)} - only sending empty name`);
|
||||
if (session.ws) {
|
||||
session.ws.send(JSON.stringify({
|
||||
type: 'game-update',
|
||||
update: { name: "" }
|
||||
}));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!_session.ws) {
|
||||
if (!session.ws) {
|
||||
console.log(`${_session.id}: -> sendUpdateToPlayers: ` +
|
||||
`Currently no connection.`);
|
||||
} else {
|
||||
_session.ws.send(message);
|
||||
session.ws.send(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user