0
0
Fork 0

Protect against undefined property error

This commit is contained in:
Oliver-Akins 2021-01-26 16:13:45 -07:00
parent 7e12fa253a
commit a5ee46bfb2

View file

@ -27,8 +27,8 @@ export default (io: Server, socket: Socket, data: StartGame) => {
}; };
// Ensure the questions deck got populated // Ensure the questions deck got populated
if (game.questions.size <= 0) { if (game.questions?.size <= 0) {
game.log.error(`Questions deck has no cards before the game started.`); game.log.error(`The questions deck has no cards in the deck.`);
socket.emit(`GameStarted`, { socket.emit(`GameStarted`, {
status: 507, status: 507,
message: `Questions deck failed to parse, try again in a few seconds or start a new game.`, message: `Questions deck failed to parse, try again in a few seconds or start a new game.`,