Protect against undefined property error
This commit is contained in:
parent
7e12fa253a
commit
a5ee46bfb2
1 changed files with 2 additions and 2 deletions
|
|
@ -27,8 +27,8 @@ export default (io: Server, socket: Socket, data: StartGame) => {
|
|||
};
|
||||
|
||||
// Ensure the questions deck got populated
|
||||
if (game.questions.size <= 0) {
|
||||
game.log.error(`Questions deck has no cards before the game started.`);
|
||||
if (game.questions?.size <= 0) {
|
||||
game.log.error(`The questions deck has no cards in the deck.`);
|
||||
socket.emit(`GameStarted`, {
|
||||
status: 507,
|
||||
message: `Questions deck failed to parse, try again in a few seconds or start a new game.`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue