From 3db0f60acfa7574eaf9f56003a79e3964aa98078 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 20 Feb 2024 19:35:03 +0000 Subject: [PATCH] fix undefined slot --- processors/processTeamfights.mjs | 4 +++- scripts/test.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/processors/processTeamfights.mjs b/processors/processTeamfights.mjs index 91717cc4..07ac6d26 100644 --- a/processors/processTeamfights.mjs +++ b/processors/processTeamfights.mjs @@ -131,7 +131,9 @@ function processTeamfights(entries, meta) { // Using slot directly as index appears to be incorrect for these fields as of 2024 (see processExpand) // So just compute an index based on player_slot const computedSlot = e.player_slot % (128 - 5); - tf.players[computedSlot][e.type][e.key] = (tf.players[computedSlot][e.type][e.key] ?? 0) + 1; + if (tf.players[computedSlot]?.[e.type]) { + tf.players[computedSlot][e.type][e.key] = (tf.players[computedSlot][e.type][e.key] ?? 0) + 1; + } } } } diff --git a/scripts/test.sh b/scripts/test.sh index 964bbc8c..b2817552 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -3,4 +3,4 @@ #curl localhost:5600 --data-binary "@/datadrive/odota-parser/7355186741_1742953546.dem" #curl localhost:5600 --data-binary "@/datadrive/odota-parser/7437280975_580771917.dem" -curl localhost:5600/blob?replay_url=http://replay153.valve.net/570/7580803996_2070517572.dem.bz2 \ No newline at end of file +curl localhost:5600/blob?replay_url=http://replay273.valve.net/570/7598355161_711705904.dem.bz2 \ No newline at end of file