From 5a956ba84649aca12a3fc2b28d3b786d4904e408 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 26 Oct 2007 23:22:35 +0000 Subject: Fix crashes and broken code in connect:parent stuff that got broken with introduction of connect:limit and slight refactor git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8382 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/configreader.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/configreader.cpp b/src/configreader.cpp index b026f5a9f..ed1216c8b 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -492,17 +492,21 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*) /* Find 'parent' and inherit a new class from it, * then overwrite any values that are set here */ - for (ClassVector::iterator item = conf->Classes.begin(); item != conf->Classes.end(); ++item) + ClassVector::iterator item = conf->Classes.begin(); + for (; item != conf->Classes.end(); ++item) { ConnectClass* c = *item; + conf->GetInstance()->Log(DEBUG,"Class: %s", c->GetName().c_str()); if (c->GetName() == parent) { - ConnectClass* c = new ConnectClass(name, c); - c->Update(timeout, flood, *allow ? allow : deny, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port, limit); - conf->Classes.push_back(c); + ConnectClass* newclass = new ConnectClass(name, c); + newclass->Update(timeout, flood, *allow ? allow : deny, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port, limit); + conf->Classes.push_back(newclass); + break; } } - throw CoreException("Class name '" + std::string(name) + "' is configured to inherit from class '" + std::string(parent) + "' which cannot be found."); + if (item == conf->Classes.end()) + throw CoreException("Class name '" + std::string(name) + "' is configured to inherit from class '" + std::string(parent) + "' which cannot be found."); } else { -- cgit v1.2.3