aboutsummaryrefslogtreecommitdiffstats
path: root/src/configreader.cpp
diff options
context:
space:
mode:
authorGravatar Peter Powell2014-10-08 16:34:37 +0100
committerGravatar Peter Powell2014-10-13 06:18:14 +0100
commit6935ce2956fed99d5484da90e614b7126e5275d3 (patch)
tree35055bf79b871df09a988e6d1b005640b2f13101 /src/configreader.cpp
parentFix various warnings when building with LLVM 3.5. (diff)
downloadinspircd++-6935ce2956fed99d5484da90e614b7126e5275d3.tar.gz
inspircd++-6935ce2956fed99d5484da90e614b7126e5275d3.tar.bz2
inspircd++-6935ce2956fed99d5484da90e614b7126e5275d3.zip
Avoid calling methods on NULL pointers wherever possible.
The trick we use to allow this is undefined behaviour and is not liked by LLVM. We should stop using it but it has the potential to break to many things for a minor release.
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r--src/configreader.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 060f66d16..b5d2fdb16 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -48,6 +48,14 @@ ServerConfig::ServerConfig()
OperMaxChans = 30;
c_ipv4_range = 32;
c_ipv6_range = 128;
+
+ std::vector<KeyVal>* items;
+ EmptyTag = ConfigTag::create("empty", "<auto>", 0, items);
+}
+
+ServerConfig::~ServerConfig()
+{
+ delete EmptyTag;
}
void ServerConfig::Update005()
@@ -888,7 +896,7 @@ ConfigTag* ServerConfig::ConfValue(const std::string &tag)
{
ConfigTagList found = config_data.equal_range(tag);
if (found.first == found.second)
- return NULL;
+ return EmptyTag;
ConfigTag* rv = found.first->second;
found.first++;
if (found.first != found.second)