Skip to content

Commit

Permalink
fix(match2): error when using ShowBracket (#5202)
Browse files Browse the repository at this point in the history
* fix(match2): error when using ShowBracket

* add comment
  • Loading branch information
Rathoz authored Dec 12, 2024
1 parent 4ce8577 commit 2d012f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/match2/commons/match_group_input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,13 @@ function MatchGroupInput.applyOverrideArgs(matches, args)
end
end

---@param matches {match2opponents: table[]}[]
---@param matches {match2opponents: table[]?, opponents: table[]?}[]
---@return integer
function MatchGroupInput.getMaxOpponentCount(matches)
return Array.reduce(matches, function(cur, match)
return math.max(#match.match2opponents, cur)
-- If the match comes from ShowBracket then it's opponents, otherwise it's match2opponents
-- Which is stupid, and needs to be fixed
return math.max(#(match.match2opponents or match.opponents or {}), cur)
end, 0)
end

Expand Down

0 comments on commit 2d012f8

Please sign in to comment.