diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 6a32ebd1c3d880..1f67296076bb25 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -234,9 +234,8 @@ void UDPWrap::BufferSize(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); CHECK(args[1]->IsUint32()); - int size = static_cast(args[0].As()->Value()); - if (size != args[0].As()->Value()) { + if (!args[0]->IsInt32()) { if (args[1].As()->Value() == 0) return env->ThrowUVException(EINVAL, "uv_recv_buffer_size"); else @@ -244,6 +243,7 @@ void UDPWrap::BufferSize(const FunctionCallbackInfo& args) { } int err; + int size = static_cast(args[0].As()->Value()); if (args[1].As()->Value() == 0) { err = uv_recv_buffer_size(reinterpret_cast(&wrap->handle_), &size);