1
0
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:
Sadie Powell
2025-10-16 14:49:04 +01:00
parent 75f764e353
commit 84dc0f3cc8
+5
View File
@@ -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))