Skip to content

Commit 39488f3

Browse files
committed
fix: guard against undefined/NaN port in reserveLoopbackPort close callback
The close callback used `=== null || <= 0` which fails to catch undefined and NaN (both skip the guard in JS). Switch to `== null || !(port > 0)` so the check mirrors the error handler's positive-check pattern and rejects any non-positive value.
1 parent 3fb511a commit 39488f3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/shared/src/Net.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,10 @@ export const make = (
247247
addressDetails = resolvedAddressDetails;
248248

249249
probe.close((cause) => {
250-
if (resolvedAddressDetails.port === null || resolvedAddressDetails.port <= 0) {
250+
if (
251+
resolvedAddressDetails.port == null ||
252+
!(resolvedAddressDetails.port > 0)
253+
) {
251254
settle(
252255
Effect.fail(
253256
new LoopbackPortAddressUnavailableError({

0 commit comments

Comments
 (0)