Skip to content

Commit

Permalink
Settings: Disallow space characters entirely
Browse files Browse the repository at this point in the history
Lua API:
> Setting names can't contain whitespace or any of ="{}#
  • Loading branch information
SmallJoker authored and sfan5 committed Jun 10, 2019
1 parent e2f8f4d commit f1f9361
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/settings.cpp
Expand Up @@ -69,7 +69,9 @@ Settings & Settings::operator = (const Settings &other)
bool Settings::checkNameValid(const std::string &name)
{
bool valid = name.find_first_of("=\"{}#") == std::string::npos;
if (valid) valid = trim(name) == name;
if (valid)
valid = std::find_if(name.begin(), name.end(), ::isspace) == name.end();

if (!valid) {
errorstream << "Invalid setting name \"" << name << "\""
<< std::endl;
Expand Down

0 comments on commit f1f9361

Please sign in to comment.