From: Jérôme Benoit Date: Thu, 2 Jun 2022 17:55:54 +0000 (+0200) Subject: Check for empty templates configuration at startup X-Git-Tag: v1.1.61~14 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=45bd0627719f5f64127e014377bae9dd999d2c4c;p=e-mobility-charging-stations-simulator.git Check for empty templates configuration at startup Signed-off-by: Jérôme Benoit --- 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(