]> jfr.im git - irc/rizon/znc.git/commitdiff
Handle a theoretically possible 'throw UNLOAD' in CModule::OnLoad()
authorpsychon <redacted>
Sat, 23 Aug 2008 20:20:36 +0000 (20:20 +0000)
committerpsychon <redacted>
Sat, 23 Aug 2008 20:20:36 +0000 (20:20 +0000)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1164 726aef4b-f618-498e-8847-2d620e286838

Modules.cpp

index 764f1f83c5ae84803f0b939d0ad92ee1001b6b53..4e949d89982efd603ddd8b63eec6af9a020313db 100644 (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;