diff --git a/src/config.cpp b/src/config.cpp index fad57d679..f277892f4 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -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("value")); + found = true; break; } } + + if (!found) + throw ConfigException("Undefined variable: " + var + " at " + file.GetName() + ":" + Anope::ToString(linenumber)); } if (!str.equals_cs(ret))