Fix parser expecting to always find templates

main
cursey 3 years ago
parent eed1e38407
commit 61d5e64d87
No known key found for this signature in database
GPG Key ID: A6A7163A1B8FD42C

@ -428,9 +428,14 @@ Project::Project(const Project *parent, const std::string &path, bool build) {
}
if (toml.contains("target") || toml.contains("template")) {
const toml::basic_value<toml::discard_comments, tsl::ordered_map, std::vector> empty_templates_table = toml::table();
auto tables = {
toml.contains("template") ? &toml::find(toml, "template") : &empty_templates_table,
&toml::find(toml, "target")
};
auto is_template = true;
for (const auto &ts : {&toml::find(toml, "template"), &toml::find(toml, "target")}) {
for (const auto &ts : tables) {
for (const auto &itr : ts->as_table()) {
const auto &value = itr.second;
auto &t = checker.create(value);

Loading…
Cancel
Save