fix: check for the connector status definition in ATG
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 31 Jul 2023 14:50:08 +0000 (16:50 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 31 Jul 2023 14:50:08 +0000 (16:50 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/AutomaticTransactionGenerator.ts

index ae4beec8186ac4c22820fec9d792714f65b4a5ec..dfab482ab2d63af90f06a7011e2e2bbf7ab5c205 100644 (file)
@@ -353,7 +353,9 @@ export class AutomaticTransactionGenerator extends AsyncResource {
   }
 
   private getConnectorStatus(connectorId: number): Status {
-    const connectorStatus = this.chargingStation.getAutomaticTransactionGeneratorStatuses()
+    const connectorStatus = this.chargingStation.getAutomaticTransactionGeneratorStatuses()?.[
+      connectorId
+    ]
       ? cloneObject<Status[]>(this.chargingStation.getAutomaticTransactionGeneratorStatuses()!)[
           connectorId
         ]