diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 18 |
1 files 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; } } |