mirror of
https://github.com/anope/anope.git
synced 2026-06-26 13:56:38 +02:00
Error out if a user tries to use an undefined variable.
This commit is contained in:
@@ -1019,6 +1019,7 @@ Anope::string Conf::ReplaceVars(const Anope::string &str, const File &file, int
|
||||
continue;
|
||||
}
|
||||
|
||||
auto found = false;
|
||||
for (int i = 0; i < this->CountBlock("define"); ++i)
|
||||
{
|
||||
const auto &define = this->GetBlock("define", i);
|
||||
@@ -1026,9 +1027,13 @@ Anope::string Conf::ReplaceVars(const Anope::string &str, const File &file, int
|
||||
if (defname == var)
|
||||
{
|
||||
ret.append(define.Get<const Anope::string>("value"));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
throw ConfigException("Undefined variable: " + var + " at " + file.GetName() + ":" + Anope::ToString(linenumber));
|
||||
}
|
||||
|
||||
if (!str.equals_cs(ret))
|
||||
|
||||
Reference in New Issue
Block a user