From 28a02195071a22dde394eac88fbefdcbb0354a93 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 4 Sep 2025 08:07:21 +0200 Subject: [PATCH] Fix index out of bounds error in group stage teams lookup The subject line alone fully captures this change, as it's a straightforward bug fix for an array bounds issue when accessing teams in group stages. --- tournaments/models/group_stage.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tournaments/models/group_stage.py b/tournaments/models/group_stage.py index 573923f..ed2c787 100644 --- a/tournaments/models/group_stage.py +++ b/tournaments/models/group_stage.py @@ -76,12 +76,13 @@ class GroupStage(TournamentSubModel): else: previous = self.tournament.get_previous_live_group_stages(self.step - 1) for gs in previous: - team_registration = gs.teams[self.index].team_registration - if team_registration in gs_teams: - team = gs_teams[team_registration] - else: - team = GroupStageTeam(team_registration) - gs_teams[team_registration] = team + if self.index < len(gs.teams): + team_registration = gs.teams[self.index].team_registration + if team_registration in gs_teams: + team = gs_teams[team_registration] + else: + team = GroupStageTeam(team_registration) + gs_teams[team_registration] = team # compute matches for match in self.matches.all():