Fix possible PluginsManager FindClose WINAPI errors

Otherwise the ERROR_INVALID_HANDLE (0x6) can be triggered.

Close #14356
pull/14359/head
xomx 2023-11-15 16:49:37 +01:00 committed by Don Ho
parent 1764758669
commit ca403b6627
1 changed files with 5 additions and 3 deletions

View File

@ -447,7 +447,7 @@ bool PluginsManager::loadPlugins(const TCHAR* dir, const PluginViewList* pluginU
pathAppend(pluginsFullPathFilter2, dllName2); pathAppend(pluginsFullPathFilter2, dllName2);
// get plugin // get plugin
if (hFindDll) if (hFindDll && (hFindDll != INVALID_HANDLE_VALUE))
{ {
::FindClose(hFindDll); ::FindClose(hFindDll);
hFindDll = INVALID_HANDLE_VALUE; hFindDll = INVALID_HANDLE_VALUE;
@ -514,8 +514,10 @@ bool PluginsManager::loadPlugins(const TCHAR* dir, const PluginViewList* pluginU
} }
} }
::FindClose(hFindFolder); if (hFindFolder && (hFindFolder != INVALID_HANDLE_VALUE))
::FindClose(hFindDll); ::FindClose(hFindFolder);
if (hFindDll && (hFindDll != INVALID_HANDLE_VALUE))
::FindClose(hFindDll);
for (size_t i = 0, len = dllNames.size(); i < len; ++i) for (size_t i = 0, len = dllNames.size(); i < len; ++i)
{ {