From: Jérôme Benoit Date: Tue, 15 Aug 2023 14:36:43 +0000 (+0200) Subject: fix: test task function name only if the received from workers X-Git-Tag: v2.6.26~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=cea399c8027c4420ae869f177d9d518d4b51775f;p=poolifier.git fix: test task function name only if the received from workers Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index 4c08671e..d36e8a47 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -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`) )