diff --git a/src/node.cc b/src/node.cc index ef770867ce6..b748795a66d 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2432,13 +2432,15 @@ static void DebugProcess(const FunctionCallbackInfo& args) { wchar_t mapping_name[32]; LPTHREAD_START_ROUTINE* handler = nullptr; + DWORD pid; + if (args.Length() != 1) { env->ThrowError("Invalid number of arguments."); goto out; } CHECK(args[0]->IsNumber()); - DWORD pid = args[0].As()->Value(); + pid = args[0].As()->Value(); process = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE |