From: <sv...@op...> - 2024-03-03 07:31:34
|
Author: manx Date: Sun Mar 3 08:31:21 2024 New Revision: 20193 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20193 Log: [Fix] mpt/library/library.hpp: When loading a library on Windows, do not return std::optional{NULL} if loading failed, but return std::nullopt instead. Otherwise, the code later gets confused as it finds a HANDLE (which is NULL) and assumes the library was loaded successfully. Non-Windows platforms were not affected. Fixes <https://bugs.openmpt.org/view.php?id=1749>. Modified: trunk/OpenMPT/src/mpt/library/library.hpp Modified: trunk/OpenMPT/src/mpt/library/library.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/library/library.hpp Sun Mar 3 00:12:57 2024 (r20192) +++ trunk/OpenMPT/src/mpt/library/library.hpp Sun Mar 3 08:31:21 2024 (r20193) @@ -304,6 +304,10 @@ #endif // MPT_OS_WINDOWS_WINRT + if (!hModule) { + return std::nullopt; + } + return library{hModule}; } |