From 1288ae8b2744b4a251d1293d1af25c0fef48ced8 Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Wed, 7 Oct 2020 17:20:05 +0200 Subject: [PATCH] fix(role-identification): temporary fix to prevent some crash --- server/app/Services/RoleIdentificationService.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/app/Services/RoleIdentificationService.js b/server/app/Services/RoleIdentificationService.js index 9c30464..1456baa 100644 --- a/server/app/Services/RoleIdentificationService.js +++ b/server/app/Services/RoleIdentificationService.js @@ -205,6 +205,14 @@ class RoleIdentificationService { metric: championPositions[champion][position], } } + + // TODO: Tmp fix + if (!Object.keys(positionsWithMetric).length) { + jungle = null + support = null + continue + } + const bestPosition = Object.keys(positionsWithMetric).reduce((posA, posB) => { return positionsWithMetric[posA].metric > positionsWithMetric[posB].metric ? posA : posB })