Fix set_if for non-numeric boolean values

fixes #8049
This commit is contained in:
Gunnar Beutner 2014-12-10 16:49:00 +01:00
parent 2720333d6e
commit 0f496c0b55
1 changed files with 17 additions and 7 deletions

View File

@ -134,15 +134,25 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab
if (!missingMacro.IsEmpty()) if (!missingMacro.IsEmpty())
continue; continue;
try { int value;
if (!Convert::ToLong(set_if_resolved))
if (set_if_resolved == "true")
value = 1;
else if (set_if_resolved == "false")
value = 0;
else {
try {
value = Convert::ToLong(set_if_resolved);
} catch (const std::exception& ex) {
/* tried to convert a string */
Log(LogWarning, "PluginUtility")
<< "Error evaluating set_if value '" << set_if_resolved << "': " << ex.what();
continue; continue;
} catch (const std::exception& ex) { }
/* tried to convert a string */
Log(LogWarning, "PluginUtility")
<< "Error evaluating set_if value '" << set_if_resolved << "': " << ex.what();
continue;
} }
if (!value)
continue;
} }
} }
else else