Make use of a default value

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2019-04-11 10:46:39 +02:00
parent a672fd0647
commit 6f439097d6
3 changed files with 15 additions and 17 deletions

View file

@ -141,13 +141,16 @@ bool Rules::has (const std::string& key) const
////////////////////////////////////////////////////////////////////////////////
// Return the configuration value given the specified key.
std::string Rules::get (const std::string& key) const
std::string Rules::get (const std::string &key, const std::string &defaultValue) const
{
auto found = _settings.find (key);
if (found != _settings.end ())
return found->second;
return "";
if (found != _settings.end ())
{
return found->second;
}
return defaultValue;
}
////////////////////////////////////////////////////////////////////////////////