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

Commit 6265ec6

Browse files
pgtedaviddias
authored andcommitted
fix: one more observer edge case
1 parent 93c558f commit 6265ec6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/protocol-muxer.js

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

16-
const handler = (protocol, _conn) => {
17-
const handlerFunc = protocols[protocol].handlerFunc
18-
if (handlerFunc) {
19-
const conn = observeConn(null, protocol, _conn, observer)
20-
handlerFunc(protocol, conn)
16+
const handler = (protocolName, _conn) => {
17+
const protocol = protocols[protocolName]
18+
if (protocol) {
19+
const handlerFunc = protocol && protocol.handlerFunc
20+
if (handlerFunc) {
21+
const conn = observeConn(null, protocol, _conn, observer)
22+
handlerFunc(protocol, conn)
23+
}
2124
}
2225
}
2326

0 commit comments

Comments
 (0)