Prepare code for strict type checking
[e-mobility-charging-stations-simulator.git] / src / charging-station / StationWorker.ts
index 84cb023b7334297d751f3bf51f7515223eac2575..5977b8e0eae322cdb32b1493d6e4719faf4357ca 100644 (file)
@@ -22,7 +22,7 @@ if (Utils.workerPoolInUse()) {
  * Listen messages send by the main thread
  */
 function addMessageListener(): void {
-  parentPort.on('message', (message) => {
+  parentPort?.on('message', (message) => {
     if (message.id === WorkerEvents.START_WORKER_ELEMENT) {
       startChargingStation(message.workerData);
     }