Skip to content

Commit

Permalink
fix matches page failing if a player fails to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
merklejerk committed Jun 17, 2024
1 parent add06c1 commit 325d7bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/routes/(app)/match/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@
}
function parseRawLogs(logs: MatchLog[]): [Round[], Address[]] {
const players = logs[1].players;
const gameCreatedLogIdx = logs.findIndex(log => log.event === 'game_created');
const players = logs[gameCreatedLogIdx].players;
const rounds = [] as Round[];
for (let roundStart = 2; roundStart < logs.length;) {
for (let roundStart = gameCreatedLogIdx + 1; roundStart < logs.length;) {
const roundEnd = findLogEventIdx('round_played', logs, roundStart) + 1;
if (roundEnd <= roundStart) {
break;
Expand Down Expand Up @@ -236,6 +237,9 @@
seasonIdx = Number(params.get('season') ?? '1') - 1;
bracketIdx = Number(params.get('bracket') ?? '1') - 1;
matchIdx = Number(params.get('idx') ?? '1') - 1;
if (isNaN(matchIdx)) {
matchIdx = undefined;
}
matchId = params.get('match') ?? undefined;
}
Expand Down

0 comments on commit 325d7bb

Please sign in to comment.