Skip to content

Commit

Permalink
fix: possibly undefined access of classic games gamecounts (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobk999 authored Aug 21, 2024
1 parent a0adc6a commit 5eb6a53
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/schemas/src/gamecounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class GameCounts {
public constructor(data: APIData = {}) {
this.ARCADE = new GamePlayers(data[GameCodeMapping.ARCADE]);
this.ARENA_BRAWL = new GamePlayers({
players: data[GameCodeMapping.CLASSIC]?.modes[GameCodeMapping.ARENA_BRAWL],
players: data[GameCodeMapping.CLASSIC]?.modes?.[GameCodeMapping.ARENA_BRAWL],
});
this.BEDWARS = new GamePlayers(data[GameCodeMapping.BEDWARS]);
this.BLITZSG = new GamePlayers(data[GameCodeMapping.BLITZSG]);
Expand All @@ -137,12 +137,12 @@ export class GameCounts {
this.MEGAWALLS = new GamePlayers(data[GameCodeMapping.MEGAWALLS]);
this.MURDER_MYSTERY = new GamePlayers(data[GameCodeMapping.MURDER_MYSTERY]);
this.PAINTBALL = new GamePlayers({
players: data[GameCodeMapping.CLASSIC]?.modes[GameCodeMapping.PAINTBALL],
players: data[GameCodeMapping.CLASSIC]?.modes?.[GameCodeMapping.PAINTBALL],
});
this.PIT = new GamePlayers(data[GameCodeMapping.PIT]);
this.PROTOTYPE = new GamePlayers(data[GameCodeMapping.PROTOTYPE]);
this.QUAKE = new GamePlayers({
players: data[GameCodeMapping.CLASSIC]?.modes[GameCodeMapping.QUAKE],
players: data[GameCodeMapping.CLASSIC]?.modes?.[GameCodeMapping.QUAKE],
});

this.QUEUE = new GamePlayers(data[GameCodeMapping.QUEUE]);
Expand All @@ -155,16 +155,16 @@ export class GameCounts {
this.TNT_GAMES = new GamePlayers(data[GameCodeMapping.TNT_GAMES]);
this.TOURNAMENT_LOBBY = new GamePlayers(data[GameCodeMapping.TOURNAMENT_LOBBY]);
this.TURBO_KART_RACERS = new GamePlayers({
players: data[GameCodeMapping.CLASSIC]?.modes[GameCodeMapping.TURBO_KART_RACERS],
players: data[GameCodeMapping.CLASSIC]?.modes?.[GameCodeMapping.TURBO_KART_RACERS],
});

this.UHC = new GamePlayers(data[GameCodeMapping.UHC]);
this.VAMPIREZ = new GamePlayers({
players: data[GameCodeMapping.CLASSIC]?.modes[GameCodeMapping.VAMPIREZ],
players: data[GameCodeMapping.CLASSIC]?.modes?.[GameCodeMapping.VAMPIREZ],
});

this.WALLS = new GamePlayers({
players: data[GameCodeMapping.CLASSIC]?.modes[GameCodeMapping.WALLS],
players: data[GameCodeMapping.CLASSIC]?.modes?.[GameCodeMapping.WALLS],
});

this.WARLORDS = new GamePlayers(data[GameCodeMapping.WARLORDS]);
Expand Down

0 comments on commit 5eb6a53

Please sign in to comment.