From b05ae332734597b5ef72fd0aa579a5823b610d14 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Thu, 1 Sep 2022 02:14:22 +0000 Subject: [PATCH] [util] Return null if HMODULE is nullptr in GetProcAddress compat dlsym with NULL will try to find the symbol from anything currently loaded. --- src/util/util_win32_compat.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/util_win32_compat.h b/src/util/util_win32_compat.h index 05597bd74..cc05b1b16 100644 --- a/src/util/util_win32_compat.h +++ b/src/util/util_win32_compat.h @@ -16,6 +16,9 @@ inline void FreeLibrary(HMODULE module) { } inline void* GetProcAddress(HMODULE module, LPCSTR lpProcName) { + if (!module) + return nullptr; + return dlsym(module, lpProcName); }