fix: ensure task function worker usage is defined before usage
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 9 May 2024 13:24:03 +0000 (15:24 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 9 May 2024 13:24:03 +0000 (15:24 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts

index 73f4e31afbc79200b85e40b1f0ddc671aac75327..2f91df9d88ebcb1661ac661726d5050eb2fda4ab 100644 (file)
@@ -1670,7 +1670,7 @@ export abstract class AbstractPool<
   ): void {
     const workerNode = this.workerNodes[workerNodeKey]
     // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
-    if (workerNode.usage != null) {
+    if (workerNode?.usage != null) {
       ++workerNode.usage.tasks.sequentiallyStolen
     }
     const taskFunctionWorkerUsage =