Skip to content

Commit

Permalink
[Fix] Hand null to the Frontend if we can't fetch a game's info (#3818
Browse files Browse the repository at this point in the history
)
  • Loading branch information
CommandMC authored Jun 13, 2024
1 parent 19ff381 commit 296d636
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/backend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,14 @@ ipcMain.handle('getGameInfo', async (event, appName, runner) => {
if (runner === 'legendary' && !LegendaryLibraryManager.hasGame(appName)) {
return null
}
return gameManagerMap[runner].getGameInfo(appName)
const tempGameInfo = gameManagerMap[runner].getGameInfo(appName)
// The game managers return an empty object if they couldn't fetch the game
// info, since most of the backend assumes getting it can never fail (and
// an empty object is a little easier to work with than `null`)
// The frontend can however handle being passed an explicit `null` value, so
// we return that here instead if the game info is empty
if (!Object.keys(tempGameInfo).length) return null
return tempGameInfo
})

ipcMain.handle('getExtraInfo', async (event, appName, runner) => {
Expand Down

0 comments on commit 296d636

Please sign in to comment.