Ensure comparison is not done on null or undefined
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 25 Mar 2022 11:34:24 +0000 (12:34 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 25 Mar 2022 11:34:24 +0000 (12:34 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 40e2c1b1fbc27d1c6070e04f099bf5a858733a68..1d18e5b6c06ca9b03f4bcec6abc067fbca37d1af 100644 (file)
@@ -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(