Fix TBA team pull for nonexistent teams.

This commit is contained in:
Patrick Fairbank
2015-08-31 22:46:24 -07:00
parent 4ea0ced315
commit 8845629dd7

View File

@@ -272,11 +272,9 @@ func getOfficialTeamInfo(teamId int) (*Team, error) {
}
// Check if the result is valid. If a team is not found, just return a basic team
if tbaTeam == nil {
if tbaTeam.TeamNumber == 0 {
team = Team{Id: teamId}
return &team, nil
}
} else {
var recentAwards []TbaAward
if eventSettings.TBAAwardsDownloadEnabled {
recentAwards, err = getTeamAwardsFromTba(teamId)
@@ -298,6 +296,7 @@ func getOfficialTeamInfo(teamId int) (*Team, error) {
team = Team{Id: teamId, Name: tbaTeam.Name, Nickname: tbaTeam.Nickname,
City: tbaTeam.Locality, StateProv: tbaTeam.Reigon,
Country: tbaTeam.Country, RookieYear: tbaTeam.RookieYear, Accomplishments: accomplishmentsBuffer.String()}
}
} else {
// If team grab is disabled, just use the team number
team = Team{Id: teamId}