fix: nil-pointer error

This commit is contained in:
Felipe M 2022-01-27 00:21:37 +01:00
parent 61f6851e33
commit cdd9ce1301
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
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)