From 9761e404d09d6dec98dd89c2b6981497a1dd9a37 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 18 Oct 2023 21:01:38 +0200 Subject: [PATCH] fix: avoid null exception at sending message to worker MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- CHANGELOG.md | 4 ++++ src/pools/thread/fixed.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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 ) -- 2.34.1