From: Jérôme Benoit Date: Sun, 23 Jul 2023 10:11:08 +0000 (+0200) Subject: fix: clone configuration only if defined X-Git-Tag: v1.2.20~165 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ae8ceef30ba0f15167f7ec0a404d637c1be73a85;p=e-mobility-charging-stations-simulator.git fix: clone configuration only if defined Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 0d1534f1..a0dd92ba 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1684,8 +1684,9 @@ export class ChargingStation { if (!existsSync(dirname(this.configurationFile))) { mkdirSync(dirname(this.configurationFile), { recursive: true }); } - let configurationData: ChargingStationConfiguration = - cloneObject(this.getConfigurationFromFile()!) ?? {}; + let configurationData: ChargingStationConfiguration = this.getConfigurationFromFile() + ? cloneObject(this.getConfigurationFromFile()!) + : {}; if (this.getStationInfoPersistentConfiguration() && this.stationInfo) { configurationData.stationInfo = this.stationInfo; } else {