From: Jérôme Benoit Date: Wed, 18 Oct 2023 19:01:38 +0000 (+0200) Subject: fix: avoid null exception at sending message to worker X-Git-Tag: v3.0.3~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9761e404d09d6dec98dd89c2b6981497a1dd9a37;p=poolifier.git fix: avoid null exception at sending message to worker Signed-off-by: Jérôme Benoit --- diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f2e445..838d0e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Avoid null exception at sending message to worker. + ## [3.0.2] - 2023-10-17 ### Fixed diff --git a/src/pools/thread/fixed.ts b/src/pools/thread/fixed.ts index bf111d39..ddda04b1 100644 --- a/src/pools/thread/fixed.ts +++ b/src/pools/thread/fixed.ts @@ -82,7 +82,7 @@ export class FixedThreadPool< ): void { ( this.workerNodes[workerNodeKey]?.messageChannel as MessageChannel - ).port1.postMessage( + )?.port1?.postMessage( { ...message, workerId: this.getWorkerInfo(workerNodeKey).id }, transferList )