From 2057e0f075b0acc0026d964323e7a190081cb8a1 Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Wed, 9 Oct 2024 18:48:18 +0200 Subject: [PATCH] ensure it's always set in the end --- components/match2/commons/match.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/match2/commons/match.lua b/components/match2/commons/match.lua index 0aeb7b5aa63..d5e9ee43b19 100644 --- a/components/match2/commons/match.lua +++ b/components/match2/commons/match.lua @@ -385,9 +385,9 @@ end function Match._prepareGameRecordForStore(matchRecord, gameRecord) gameRecord.parent = matchRecord.parent gameRecord.tournament = matchRecord.tournament - if not gameRecord.participants and gameRecord.opponents then + if not gameRecord.participants then gameRecord.participants = {} - for opponentId, opponent in ipairs(gameRecord.opponents) do + for opponentId, opponent in ipairs(gameRecord.opponents or {}) do for playerId, player in pairs(opponent.players) do -- Deep copy have to be used here, otherwise a json.stringify complains about circular references -- between participants and opponents