From: Jérôme Benoit Date: Thu, 4 Jan 2024 14:11:35 +0000 (+0100) Subject: fix: readd safety check in charging station log prefix helper X-Git-Tag: v1.2.32~62 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=41f18326bd0c915a2390208ab1c1973cc6c82a6e;p=e-mobility-charging-stations-simulator.git fix: readd safety check in charging station log prefix helper Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index a57b5bd4..8029178b 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -238,8 +238,12 @@ export class ChargingStation extends EventEmitter { } public logPrefix = (): string => { - if (isNotEmptyString(this.stationInfo?.chargingStationId)) { - return logPrefix(` ${this.stationInfo?.chargingStationId} |`) + if ( + this instanceof ChargingStation && + this.stationInfo != null && + isNotEmptyString(this.stationInfo.chargingStationId) + ) { + return logPrefix(` ${this.stationInfo.chargingStationId} |`) } let stationTemplate: ChargingStationTemplate | undefined try {