Skip to content

Commit

Permalink
fix(match2): AoE: Prevent hard error on missing team template (#4562)
Browse files Browse the repository at this point in the history
* fix(match2) AoE: Prevent hard error on missing team template

* Whitespace
  • Loading branch information
mbergen authored Aug 19, 2024
1 parent 761d569 commit 826a786
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 826a786

Please sign in to comment.