From 7b8ed01f272fc4c6b69ff6299185e936a5e63735 Mon Sep 17 00:00:00 2001 From: Nelson Chan Date: Fri, 24 Feb 2023 21:06:00 +0800 Subject: [PATCH 1/2] Fix: getGameList returns nothing on first run --- server/socket-handlers/general-socket-handler.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/socket-handlers/general-socket-handler.js b/server/socket-handlers/general-socket-handler.js index 11b47a5bf..484121839 100644 --- a/server/socket-handlers/general-socket-handler.js +++ b/server/socket-handlers/general-socket-handler.js @@ -12,7 +12,7 @@ let gameList = null; * @returns {any[]} */ function getGameList() { - if (!gameList) { + if (gameList == null) { gameList = gameResolver._readGames().games.sort((a, b) => { if ( a.pretty < b.pretty ) { return -1; @@ -22,9 +22,8 @@ function getGameList() { } return 0; }); - } else { - return gameList; } + return gameList; } module.exports.generalSocketHandler = (socket, server) => { From c65a920050688afed790a8bc6e400f45ee32f54c Mon Sep 17 00:00:00 2001 From: Nelson Chan Date: Fri, 24 Feb 2023 21:09:55 +0800 Subject: [PATCH 2/2] Chore: Fix code comment --- server/socket-handlers/general-socket-handler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/socket-handlers/general-socket-handler.js b/server/socket-handlers/general-socket-handler.js index 484121839..bb4a38086 100644 --- a/server/socket-handlers/general-socket-handler.js +++ b/server/socket-handlers/general-socket-handler.js @@ -9,7 +9,7 @@ let gameList = null; /** * Get a game list via GameDig - * @returns {any[]} + * @returns {Object[]} list of games supported by GameDig */ function getGameList() { if (gameList == null) {