fix: nil-pointer error

This commit is contained in:
Felipe M 2022-01-27 00:21:37 +01:00 committed by Felipe Martin Garcia
parent d0c2d4ff07
commit 76afe81086
2 changed files with 2 additions and 2 deletions

View File

@ -61,7 +61,7 @@ func addScreenshotToGame(userGames []*models.Game, switchGame SwitchGame, screen
}
}
if foundGame.ID == "" {
if foundGame == nil {
foundGame := models.Game{Name: switchGame.Name, ID: switchGame.EncryptedGameID, Platform: platformName, Provider: platformName}
foundGame.Screenshots = append(foundGame.Screenshots, screenshot)
userGames = append(userGames, &foundGame)

View File

@ -11,7 +11,7 @@ func addScreenshotToGame(userGames []*models.Game, gameName string, screenshot m
}
}
if foundGame.ID == "" {
if foundGame == nil {
foundGame := models.Game{Name: gameName, ID: gameName, Platform: platformName, Provider: platformName}
foundGame.Screenshots = append(foundGame.Screenshots, screenshot)
userGames = append(userGames, &foundGame)