src: fix WITH_GENERIC_STREAM() type check bug
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 6 Aug 2013 13:47:42 +0000 (15:47 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Tue, 6 Aug 2013 13:47:44 +0000 (15:47 +0200)
The handle object was checked against the wrong constructor template.
Put another way, it was unwrapped as the wrong StreamWrap type.

src/node_wrap.h

index c03b30e..7c3f63f 100644 (file)
@@ -40,7 +40,7 @@ extern v8::Persistent<v8::FunctionTemplate> tcpConstructorTmpl;
     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)) {  \
@@ -48,7 +48,7 @@ extern v8::Persistent<v8::FunctionTemplate> tcpConstructorTmpl;
         BODY                                              \
       } else if (!pipeConstructorTmpl.IsEmpty() &&        \
                  HasInstance(pipeConstructorTmpl, obj)) { \
-        TCPWrap* wrap = TCPWrap::Unwrap(obj);             \
+        PipeWrap* wrap = PipeWrap::Unwrap(obj);           \
         BODY                                              \
       }                                                   \
     } while (0)