fix: test task function name only if the received from workers
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 15 Aug 2023 14:36:43 +0000 (16:36 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 15 Aug 2023 14:36:43 +0000 (16:36 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts

index 4c08671e5d99ab362f4b0263a423cfe42b4af5e5..d36e8a4737dbe5514aa936de561780baee5ba528 100644 (file)
@@ -672,7 +672,11 @@ export abstract class AbstractPool<
       ) {
         reject(new TypeError('name argument must not be an empty string'))
       }
-      if (name != null && !this.taskFunctions.includes(name)) {
+      if (
+        name != null &&
+        this.taskFunctions != null &&
+        !this.taskFunctions.includes(name)
+      ) {
         reject(
           new Error(`Task function '${name}' is not registered in the pool`)
         )