Skip to content

Commit d1edce0

Browse files
committed
DBG: small improvement to Handle class
By @torusrxxx
1 parent 4db8d02 commit d1edce0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/dbg/handle.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ class Handle
1818

1919
void Close()
2020
{
21-
DWORD dwFlags = 0;
22-
if(GetHandleInformation(mHandle, &dwFlags) && !(dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE))
23-
CloseHandle(mHandle);
24-
mHandle = INVALID_HANDLE_VALUE;
21+
if(mHandle != INVALID_HANDLE_VALUE)
22+
{
23+
DWORD dwFlags = 0;
24+
if(GetHandleInformation(mHandle, &dwFlags) && !(dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE))
25+
CloseHandle(mHandle);
26+
mHandle = INVALID_HANDLE_VALUE;
27+
}
2528
}
2629

2730
const HANDLE & operator=(const HANDLE & h)

0 commit comments

Comments
 (0)