fix: enforce single semicolon in directives and handle multiple semicolons

This commit is contained in:
whaffman 2025-10-31 15:09:50 +01:00
parent 0aa1fd5bc1
commit fe3b28fbfe

View File

@ -22,8 +22,12 @@ void AConfig::addDirective(const std::string &line)
++semicolon_count;
}
}
if (semicolon_count > 1)
{
throw std::runtime_error("Directive contains multiple semicolons: " + line);
}
if (semicolon_count != 1 || line.back() != ';')
if (line.back() != ';')
{
throw std::runtime_error("Directive must end with a single semicolon");
}