Handle a theoretically possible 'throw UNLOAD' in CModule::OnLoad()

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1164 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-08-23 20:20:36 +00:00
parent c0c563de55
commit b0903c0208
+9 -1
View File
@@ -795,7 +795,15 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CUser* p
pModule->SetDescription(GetDesc());
push_back(pModule);
if (!pModule->OnLoad(sArgs, sRetMsg)) {
bool bLoaded;
try {
bLoaded = pModule->OnLoad(sArgs, sRetMsg);
} catch (CModule::EModException e) {
bLoaded = false;
sRetMsg = "Caught an exception";
}
if (!bLoaded) {
UnloadModule(sModule, sModPath);
if (!sRetMsg.empty())
sRetMsg = "Module [" + sModule + "] aborted: " + sRetMsg;