From 85e9c52f8dad38c12acc632d964ec3f6c470fe16 Mon Sep 17 00:00:00 2001 From: sose Date: Wed, 7 Apr 2021 10:57:36 +0000 Subject: [PATCH] fixed breakage when parsing one-map games --- sk0r.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sk0r.js b/sk0r.js index 4b000e9..59a27d4 100644 --- a/sk0r.js +++ b/sk0r.js @@ -72,8 +72,12 @@ function update_scores(hltv_url) { if (score_row.className === "livescore twoRowExtraRow") { var score_el = score_row.querySelector("[data-livescore-current-map-score='']"); var maps_won_el = score_row.querySelector("[data-livescore-maps-won-for='']"); - rounds_won.push(score_el.innerText); - maps_won.push(maps_won_el.innerText); + if (score_el !== null) { + rounds_won.push(score_el.innerText); + } + if (maps_won_el !== null) { + maps_won.push(maps_won_el.innerText); + } } else if (score_row.className.includes("twoRowExtraRow won") || score_row.className.includes("twoRowExtraRow lost")) { maps_won.push(score_row.innerText); @@ -144,7 +148,7 @@ async function run(hltv_url, host, port) { response.end(); }) .catch(error => { - response.write(error); + response.write(String(error)); response.end(); }); }