From 45bd0627719f5f64127e014377bae9dd999d2c4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 2 Jun 2022 19:55:54 +0200 Subject: [PATCH] Check for empty templates configuration at startup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/Bootstrap.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 211cf020..cf7208ef 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -75,7 +75,7 @@ export default class Bootstrap { const stationTemplateUrls = Configuration.getStationTemplateUrls(); this.numberOfChargingStationTemplates = stationTemplateUrls.length; // Start ChargingStation object in worker thread - if (stationTemplateUrls) { + if (!Utils.isEmptyArray(stationTemplateUrls)) { for (const stationTemplateUrl of stationTemplateUrls) { try { const nbStations = stationTemplateUrl.numberOfStations ?? 0; @@ -94,7 +94,9 @@ export default class Bootstrap { } } } else { - console.warn(chalk.yellow("No 'stationTemplateUrls' defined in configuration, exiting")); + console.warn( + chalk.yellow("'stationTemplateUrls' not defined or empty in configuration, exiting") + ); } if (this.numberOfChargingStations === 0) { console.warn( -- 2.34.1