Skip to content

Commit dad02a0

Browse files
author
Chung-Yu Liao
committed
Add process handle checking for Windows.
1 parent e3958a5 commit dad02a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/interface.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -1311,8 +1311,10 @@ static void option_do_kill(struct nvtop_interface *inter) {
13111311
#ifdef _WIN32
13121312
HANDLE hProc;
13131313
hProc = OpenProcess(PROCESS_TERMINATE, false, pid);
1314-
TerminateProcess(hProc, sig);
1315-
CloseHandle(hProc);
1314+
if (hProc != NULL) {
1315+
TerminateProcess(hProc, sig);
1316+
CloseHandle(hProc);
1317+
}
13161318
#else
13171319
kill(pid, sig);
13181320
#endif

0 commit comments

Comments
 (0)