From 2216c93e40fbb57eb3db4c3c21128cbd4d800096 Mon Sep 17 00:00:00 2001 From: psychon Date: Mon, 13 Oct 2008 18:53:43 +0000 Subject: [PATCH] Catch 'throw UNLOAD' in the OnBoot module hook Before this ZNC died because of an uncaught exception :( git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1249 726aef4b-f618-498e-8847-2d620e286838 --- Modules.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Modules.cpp b/Modules.cpp index 8d85c2c0..fac7d028 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -562,8 +562,14 @@ void CModules::UnloadAll() { bool CModules::OnBoot() { for (unsigned int a = 0; a < size(); a++) { - if (!(*this)[a]->OnBoot()) { - return false; + try { + if (!(*this)[a]->OnBoot()) { + return false; + } + } catch (CModule::EModException e) { + if (e == CModule::UNLOAD) { + UnloadModule((*this)[a]->GetModName()); + } } }