fixed breakage when parsing one-map games

This commit is contained in:
sose 2021-04-07 10:57:36 +00:00
parent 3b93b05230
commit 85e9c52f8d
1 changed files with 7 additions and 3 deletions

10
sk0r.js
View File

@ -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();
});
}