The handle object was checked against the wrong constructor template.
Put another way, it was unwrapped as the wrong StreamWrap type.
do { \
if (!tcpConstructorTmpl.IsEmpty() && \
HasInstance(tcpConstructorTmpl, obj)) { \
- PipeWrap* wrap = PipeWrap::Unwrap(obj); \
+ TCPWrap* wrap = TCPWrap::Unwrap(obj); \
BODY \
} else if (!ttyConstructorTmpl.IsEmpty() && \
HasInstance(ttyConstructorTmpl, obj)) { \
BODY \
} else if (!pipeConstructorTmpl.IsEmpty() && \
HasInstance(pipeConstructorTmpl, obj)) { \
- TCPWrap* wrap = TCPWrap::Unwrap(obj); \
+ PipeWrap* wrap = PipeWrap::Unwrap(obj); \
BODY \
} \
} while (0)