diff --git a/functions/src/scheduler/utils/update.swissunihockey.ts b/functions/src/scheduler/utils/update.swissunihockey.ts index 2a148c2..288c259 100644 --- a/functions/src/scheduler/utils/update.swissunihockey.ts +++ b/functions/src/scheduler/utils/update.swissunihockey.ts @@ -236,8 +236,8 @@ export async function updateGamesSwissunihockey(): Promise { } } - // Get rankings - if (gamesData.docs.length > 0) { + // Get rankings (only if there are games available) + if (gamesData && gamesData.docs) { const teamRankings = await resolversSU.Team.rankings({id: `${team.id}`}, {}, {}, {}); console.log(" >> READ TEAM RANKINGS"); for (const item of teamRankings) {