Null checks
This commit is contained in:
parent
02b7708976
commit
a18644d40e
@ -1,4 +1,4 @@
|
|||||||
FROM node:12
|
FROM node:14
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
4
room.js
4
room.js
@ -108,9 +108,11 @@ function reset(roomId) {
|
|||||||
room.canBuzz = true;
|
room.canBuzz = true;
|
||||||
|
|
||||||
room.participants.forEach(p => {
|
room.participants.forEach(p => {
|
||||||
|
if (p.ws) {
|
||||||
p.ws.send(JSON.stringify({
|
p.ws.send(JSON.stringify({
|
||||||
type: "reset"
|
type: "reset"
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,11 +139,13 @@ function updateScore(roomId, participantId, points) {
|
|||||||
|
|
||||||
participant.score += points;
|
participant.score += points;
|
||||||
|
|
||||||
|
if (participant.ws) {
|
||||||
participant.ws.send(JSON.stringify({
|
participant.ws.send(JSON.stringify({
|
||||||
type: "score",
|
type: "score",
|
||||||
score: participant.score,
|
score: participant.score,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
room.audience.forEach(ws => {
|
room.audience.forEach(ws => {
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
|
Loading…
Reference in New Issue
Block a user