summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_motd.cpp2
-rw-r--r--src/commands/cmd_rules.cpp2
-rw-r--r--src/configreader.cpp10
3 files changed, 11 insertions, 3 deletions
diff --git a/src/commands/cmd_motd.cpp b/src/commands/cmd_motd.cpp
index 8e227723e..869a9c353 100644
--- a/src/commands/cmd_motd.cpp
+++ b/src/commands/cmd_motd.cpp
@@ -53,7 +53,7 @@ CmdResult CommandMotd::Handle (const std::vector<std::string>& parameters, User
if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName)
return CMD_SUCCESS;
- ConfigTag* tag = NULL;
+ ConfigTag* tag = ServerInstance->Config->EmptyTag;
if (IS_LOCAL(user))
tag = user->GetClass()->config;
std::string motd_name = tag->getString("motd", "motd");
diff --git a/src/commands/cmd_rules.cpp b/src/commands/cmd_rules.cpp
index 5d41aa4b8..17de9f3f2 100644
--- a/src/commands/cmd_rules.cpp
+++ b/src/commands/cmd_rules.cpp
@@ -51,7 +51,7 @@ CmdResult CommandRules::Handle (const std::vector<std::string>& parameters, User
if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName)
return CMD_SUCCESS;
- ConfigTag* tag = NULL;
+ ConfigTag* tag = ServerInstance->Config->EmptyTag;
if (IS_LOCAL(user))
tag = user->GetClass()->config;
std::string rules_name = tag->getString("rules", "rules");
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)