Fix missing config validator for command arguments 'set_if'

fixes #8724
This commit is contained in:
Michael Friedrich 2015-03-12 18:05:58 +01:00
parent 86a1bbf468
commit 7c0749679c
1 changed files with 27 additions and 9 deletions

View File

@ -72,19 +72,37 @@ void Command::ValidateArguments(const String& location, const Command::Ptr& obje
if (arginfo.IsObjectType<Dictionary>()) { if (arginfo.IsObjectType<Dictionary>()) {
Dictionary::Ptr argdict = arginfo; Dictionary::Ptr argdict = arginfo;
if (argdict->Contains("value")) if (argdict->Contains("value")) {
argval = argdict->Get("value"); String argvalue = argdict->Get("value");
} else
if (!MacroProcessor::ValidateMacroString(argvalue)) {
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
location + ": Closing $ not found in macro format string '" + argvalue + "'.", object->GetDebugInfo()));
}
}
if (argdict->Contains("set_if")) {
String argsetif = argdict->Get("set_if");
if (!MacroProcessor::ValidateMacroString(argsetif)) {
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
location + ": Closing $ not found in macro format string '" + argsetif + "'.", object->GetDebugInfo()));
}
}
} else if (arginfo.IsObjectType<Function>()) {
continue; /* we cannot evaluate macros in functions */
} else {
argval = arginfo; argval = arginfo;
if (argval.IsEmpty()) if (argval.IsEmpty())
continue; continue;
String argstr = argval; String argstr = argval;
if (!MacroProcessor::ValidateMacroString(argstr)) { if (!MacroProcessor::ValidateMacroString(argstr)) {
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " + BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
location + ": Closing $ not found in macro format string '" + argstr + "'.", object->GetDebugInfo())); location + ": Closing $ not found in macro format string '" + argstr + "'.", object->GetDebugInfo()));
}
} }
} }
} }