fix: avoid null exception at sending message to worker
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 18 Oct 2023 19:01:38 +0000 (21:01 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 18 Oct 2023 19:01:38 +0000 (21:01 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
CHANGELOG.md
src/pools/thread/fixed.ts

index b7f2e44568f1afc6d3a100342e46d8a94d0c8223..838d0e6816d6015bd283b9c89c19e00f825c4e63 100644 (file)
@@ -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
index bf111d39482528c4078f13e5c76557d565895f7f..ddda04b113ec9028b0cd24c8f53001d12714a901 100644 (file)
@@ -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
     )