diff --git a/src/config.cpp b/src/config.cpp index 4a454b41..0aecc3ca 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -762,12 +762,18 @@ void list_string_f(std::unordered_map &vars, const std input.emplace_back(begin, pos); } } + void list_prep_cmd_f(std::unordered_map &vars, const std::string &name, std::vector &input) { std::string string; string_f(vars, name, string); std::stringstream jsonStream; + // check if string is empty, i.e. when the value doesn't exist in the config file + if(string.empty()) { + return; + } + // We need to add a wrapping object to make it valid JSON, otherwise ptree cannot parse it. jsonStream << "{\"prep_cmd\":" << string << "}";