do not crash if no tcp connections are desired

This commit is contained in:
Patricio Whittingslow
2025-10-22 19:19:32 -03:00
parent 407f4a08f1
commit bb4053647d
6 changed files with 19 additions and 12 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ func (ps *StackPorts) Reset(protocol uint64, dstPortOffset uint16, maxNodes int)
if protocol > math.MaxUint16 {
return errInvalidProto
} else if maxNodes <= 0 {
return errZeroMaxNodes
return errZeroMaxNodesArg
}
ps.handlers = slices.Grow(ps.handlers[:0], maxNodes)
*ps = StackPorts{