From a0b4b19b004f374d54c224a61ca27f779d54b981 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 11 Apr 2005 19:40:53 +0000 Subject: [PATCH] More module fixes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1051 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index a432c6181..4d02529cc 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -3537,15 +3537,15 @@ bool LoadModule(const char* filename) MODCOUNT--; return false; } + bool mextended = false; + while (modules.size() <= MODCOUNT+1) + { + modules.push_back(NULL); + log(DEFAULT,"Extending modules[]"); + bool mextended = true; + } if (factory[MODCOUNT+1]->factory) { - bool mextended = false; - while (modules.size() <= MODCOUNT+1) - { - modules.push_back(NULL); - log(DEFAULT,"Extending modules[]"); - bool mextended = true; - } Module* m = factory[MODCOUNT+1]->factory->CreateModule(); modules[MODCOUNT+1] = m; /* save the module and the module's classfactory, if @@ -3560,6 +3560,10 @@ bool LoadModule(const char* filename) { log(DEFAULT,"Unable to load %s",modfile); snprintf(MODERR,MAXBUF,"Factory function failed!"); + if (extended) + factory.erase(factory.end()); + if (mextended) + modules.erase(modules.end()); return false; } } -- 2.39.5