inline bool HasInstance(
const v8::Persistent<v8::FunctionTemplate>& function_template,
v8::Handle<v8::Value> value) {
+ if (function_template.IsEmpty()) return false;
v8::Local<v8::FunctionTemplate> function_template_handle =
PersistentToLocal(node_isolate, function_template);
return function_template_handle->HasInstance(value);
#define WITH_GENERIC_STREAM(obj, BODY) \
do { \
- if (!tcpConstructorTmpl.IsEmpty() && \
- HasInstance(tcpConstructorTmpl, obj)) { \
+ if (HasInstance(tcpConstructorTmpl, obj)) { \
TCPWrap* wrap = TCPWrap::Unwrap(obj); \
BODY \
- } else if (!ttyConstructorTmpl.IsEmpty() && \
- HasInstance(ttyConstructorTmpl, obj)) { \
+ } else if (HasInstance(ttyConstructorTmpl, obj)) { \
TTYWrap* wrap = TTYWrap::Unwrap(obj); \
BODY \
- } else if (!pipeConstructorTmpl.IsEmpty() && \
- HasInstance(pipeConstructorTmpl, obj)) { \
+ } else if (HasInstance(pipeConstructorTmpl, obj)) { \
PipeWrap* wrap = PipeWrap::Unwrap(obj); \
BODY \
} \