mirror of
https://github.com/znc/znc.git
synced 2026-08-06 17:03:14 +02:00
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:
+9
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user