From 586abc72dab240bc9e4d6bfd60a53a26f0811422 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 15 Nov 2019 11:33:09 +0000 Subject: [PATCH 1/1] Improve reading xlines from the server configuration. --- src/configreader.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/configreader.cpp b/src/configreader.cpp index 0318dd602..782a80080 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -80,11 +80,16 @@ static void ReadXLine(ServerConfig* conf, const std::string& tag, const std::str for(ConfigIter i = tags.first; i != tags.second; ++i) { ConfigTag* ctag = i->second; - std::string mask; - if (!ctag->readString(key, mask)) - throw CoreException("<"+tag+":"+key+"> missing at " + ctag->getTagLocation()); - std::string reason = ctag->getString("reason", ""); - XLine* xl = make->Generate(ServerInstance->Time(), 0, "", reason, mask); + + const std::string mask = ctag->getString(key); + if (mask.empty()) + throw CoreException("<" + tag + ":" + key + "> missing at " + ctag->getTagLocation()); + + const std::string reason = ctag->getString("reason"); + if (reason.empty()) + throw CoreException("<" + tag + ":reason> missing at " + ctag->getTagLocation()); + + XLine* xl = make->Generate(ServerInstance->Time(), 0, ServerInstance->Config->ServerName, reason, mask); xl->from_config = true; configlines.insert(xl->Displayable()); if (!ServerInstance->XLines->AddLine(xl, NULL)) -- 2.39.2