From: <sv...@op...> - 2024-03-03 07:32:14
|
Author: manx Date: Sun Mar 3 08:32:03 2024 New Revision: 20194 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20194 Log: Merged revision(s) 20193 from trunk/OpenMPT: [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: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/src/mpt/library/library.hpp Modified: branches/OpenMPT-1.31/src/mpt/library/library.hpp ============================================================================== --- branches/OpenMPT-1.31/src/mpt/library/library.hpp Sun Mar 3 08:31:21 2024 (r20193) +++ branches/OpenMPT-1.31/src/mpt/library/library.hpp Sun Mar 3 08:32:03 2024 (r20194) @@ -304,6 +304,10 @@ #endif // MPT_OS_WINDOWS_WINRT + if (!hModule) { + return std::nullopt; + } + return library{hModule}; } |