Skip to content
Permalink
Browse files

Settings: Disallow space characters entirely

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 f1f9361bc80760b05c717f3e44697f0b7d2e073a
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/settings.cpp
@@ -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;

0 comments on commit f1f9361

Please sign in to comment.
You can’t perform that action at this time.