From 826a7865e05b0f1d1bbf602086c68e80745f855e Mon Sep 17 00:00:00 2001 From: mbergen Date: Mon, 19 Aug 2024 10:00:13 +0200 Subject: [PATCH] fix(match2): AoE: Prevent hard error on missing team template (#4562) * fix(match2) AoE: Prevent hard error on missing team template * Whitespace --- .../wikis/ageofempires/match_group_input_custom.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/match2/wikis/ageofempires/match_group_input_custom.lua b/components/match2/wikis/ageofempires/match_group_input_custom.lua index 19700cdb42f..0438cc9a5b1 100644 --- a/components/match2/wikis/ageofempires/match_group_input_custom.lua +++ b/components/match2/wikis/ageofempires/match_group_input_custom.lua @@ -271,11 +271,14 @@ function CustomMatchGroupInput._getOpponents(match) match['opponent' .. opponentIndex] = opponent if opponent.type == Opponent.team and Logic.isNotEmpty(opponent.template) then - MatchGroupInput.readPlayersOfTeam(match, opponentIndex, mw.ext.TeamTemplate.raw(opponent.template).page, { - resolveRedirect = true, - applyUnderScores = true, - maxNumPlayers = MAX_NUM_PLAYERS, - }) + local template = mw.ext.TeamTemplate.raw(opponent.template) + if template then + MatchGroupInput.readPlayersOfTeam(match, opponentIndex, template.page, { + resolveRedirect = true, + applyUnderScores = true, + maxNumPlayers = MAX_NUM_PLAYERS, + }) + end end end