Skip to content

Commit e4fa035

Browse files
KernelDeimoslsongdev
authored andcommitted
fix: make udp4 default more resilient
If 'type' was not specified in an object argument to the constructor of UDPSocket, it would result in an undefined value. This is probably not what the user intended and it always results in an exception being thrown.
1 parent ded06ca commit e4fa035

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/udp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Server extends udp.Socket {
1010
constructor(options) {
1111
let type = 'udp4';
1212
if (typeof options === 'object') {
13-
type = options.type;
13+
type = options.type ?? type;
1414
}
1515
super(type);
1616
if (typeof options === 'function') {

0 commit comments

Comments
 (0)