From: Jérôme Benoit Date: Sun, 14 Jan 2024 11:32:08 +0000 (+0100) Subject: fix: fix nullish exception on boot notification handling X-Git-Tag: v1.2.32~10 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=01d2a2c71e1b235cd01ec53b2559b9fb99c67f4f;p=e-mobility-charging-stations-simulator.git fix: fix nullish exception on boot notification handling Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 7534f66e..79d2c753 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1761,11 +1761,13 @@ export class ChargingStation extends EventEmitter { >(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, { skipBufferingOnError: true }) - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - this.bootNotificationResponse.currentTime = convertToDate( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - this.bootNotificationResponse?.currentTime - )! + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (this.bootNotificationResponse?.currentTime != null) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.bootNotificationResponse.currentTime = convertToDate( + this.bootNotificationResponse.currentTime + )! + } if (!this.isRegistered()) { this.stationInfo?.registrationMaxRetries !== -1 && ++registrationRetryCount await sleep(