Skip to content
This repository was archived by the owner on Aug 23, 2019. It is now read-only.

Commit ae6b52e

Browse files
pgtedaviddias
authored andcommitted
fix: for when handler func is not defined
1 parent 8b326a7 commit ae6b52e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/protocol-muxer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ module.exports = function protocolMuxer (protocols, observer) {
1414
}
1515

1616
const handler = (protocol, _conn) => {
17-
const conn = observeConn(null, protocol, _conn, observer)
18-
protocols[protocol].handlerFunc.call(null, protocol, conn)
17+
const handlerFunc = protocols[protocol].handlerFunc
18+
if (handlerFunc) {
19+
const conn = observeConn(null, protocol, _conn, observer)
20+
handlerFunc(protocol, conn)
21+
}
1922
}
2023

2124
ms.addHandler(protocol, handler, protocols[protocol].matchFunc)

0 commit comments

Comments
 (0)