Skip to content

Commit 740e2cc

Browse files
authored
Check return value for GetModuleHandleExA. (#563)
1 parent d872d5f commit 740e2cc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pch_mgr.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@ bool ResourceManager::GetResourceWin32(const char *id, const char *pszType,
123123
const char *&res, size_t &size) {
124124
HMODULE hMod = NULL;
125125
// Get the handle to the current module
126-
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
127-
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
128-
(LPCSTR)dummy, &hMod);
126+
if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
127+
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
128+
(LPCSTR)dummy, &hMod))
129+
return false;
130+
129131
if (!hMod) {
130132
return false;
131133
}

0 commit comments

Comments
 (0)