Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(match2): lol matchpage missing a nil check #5268

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions components/match2/wikis/leagueoflegends/match_page.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
local Array = require('Module:Array')
local CharacterIcon = require('Module:CharacterIcon')
local DateExt = require('Module:Date/Ext')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local Links = require('Module:Links')
local Operator = require('Module:Operator')
Expand Down Expand Up @@ -87,22 +88,23 @@ function MatchPage.getByMatchId(props)
Array.forEach(viewModel.games, function(game)
game.finished = game.winner ~= nil and game.winner ~= -1
game.teams = Array.map(game.opponents, function(opponent, teamIdx)
local team = {players = {}}
local team = {}

team.scoreDisplay = game.winner == teamIdx and 'W' or game.finished and 'L' or '-'
team.side = String.nilIfEmpty(game.extradata['team' .. teamIdx ..'side'])

for _, player in ipairs(opponent.players) do
table.insert(team.players, Table.mergeInto(player, {
team.players = Array.map(opponent.players, function(player)
if Logic.isDeepEmpty(player) then return end
return Table.mergeInto(player, {
roleIcon = player.role .. ' ' .. team.side,
items = Array.map(Array.range(1, ITEMS_TO_SHOW), function(idx)
return player.items[idx] or DEFAULT_ITEM
end),
runeKeystone = Array.filter(player.runes.primary.runes, function(rune)
return KEYSTONES[rune]
end)[1]
}))
end
})
end)

if game.finished then
-- Aggregate stats
Expand Down
Loading