From: Jérôme Benoit Date: Sun, 29 Aug 2021 13:31:58 +0000 (+0200) Subject: Add a sanity check at worker implementation options check X-Git-Tag: v1.0.52~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2f70f96f076d2689ff4f392dd32f8499cb2e4100;p=e-mobility-charging-stations-simulator.git Add a sanity check at worker implementation options check Signed-off-by: Jérôme Benoit --- diff --git a/src/worker/WorkerFactory.ts b/src/worker/WorkerFactory.ts index d97e9604..55cb1da7 100644 --- a/src/worker/WorkerFactory.ts +++ b/src/worker/WorkerFactory.ts @@ -19,7 +19,7 @@ export default class WorkerFactory { throw new Error('Trying to get a worker implementation outside the main thread'); } options = options ?? {} as WorkerOptions; - options.startDelay = options.startDelay ?? Constants.WORKER_START_DELAY; + options.startDelay = options?.startDelay ?? Constants.WORKER_START_DELAY; options.poolOptions = options?.poolOptions ?? {} as PoolOptions; options?.messageHandler && (options.poolOptions.messageHandler = options.messageHandler); let workerImplementation: WorkerAbstract = null;