Skip to content

Commit

Permalink
Merge pull request #2835 from chakflying/fix/game-list-empty
Browse files Browse the repository at this point in the history
Fix: getGameList returns nothing on first run
  • Loading branch information
louislam authored Feb 24, 2023
2 parents cecb0b6 + c65a920 commit c4a9374
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server/socket-handlers/general-socket-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ let gameList = null;

/**
* Get a game list via GameDig
* @returns {any[]}
* @returns {Object[]} list of games supported by GameDig
*/
function getGameList() {
if (!gameList) {
if (gameList == null) {
gameList = gameResolver._readGames().games.sort((a, b) => {
if ( a.pretty < b.pretty ) {
return -1;
Expand All @@ -22,9 +22,8 @@ function getGameList() {
}
return 0;
});
} else {
return gameList;
}
return gameList;
}

module.exports.generalSocketHandler = (socket, server) => {
Expand Down

0 comments on commit c4a9374

Please sign in to comment.