summaryrefslogtreecommitdiff
path: root/src/tcp_wrap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tcp_wrap.cc')
-rw-r--r--src/tcp_wrap.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index dd507e6ebd..d8080319aa 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -207,7 +207,10 @@ void TCPWrap::Open(const FunctionCallbackInfo<Value>& args) {
ASSIGN_OR_RETURN_UNWRAP(&wrap,
args.Holder(),
args.GetReturnValue().Set(UV_EBADF));
- int fd = static_cast<int>(args[0]->IntegerValue());
+ int64_t val;
+ if (!args[0]->IntegerValue(args.GetIsolate()->GetCurrentContext()).To(&val))
+ return;
+ int fd = static_cast<int>(val);
int err = uv_tcp_open(&wrap->handle_, fd);
if (err == 0)