From: Jérôme Benoit Date: Fri, 25 Mar 2022 11:34:24 +0000 (+0100) Subject: Ensure comparison is not done on null or undefined X-Git-Tag: v1.1.57~27 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b47d68d7c1e315d6d111dd6471f3ac95fd7bfab1;p=e-mobility-charging-stations-simulator.git Ensure comparison is not done on null or undefined Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 40e2c1b1..1d18e5b6 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -237,7 +237,10 @@ export default class ChargingStation { public getConnectorMaximumAvailablePower(connectorId: number): number { let connectorAmperageLimitationPowerLimit: number; - if (this.getAmperageLimitation() < this.stationInfo.maximumAmperage) { + if ( + !Utils.isNullOrUndefined(this.getAmperageLimitation()) && + this.getAmperageLimitation() < this.stationInfo.maximumAmperage + ) { const amperageLimitationPowerLimit = this.getCurrentOutType() === CurrentType.AC ? ACElectricUtils.powerTotal(