Skip to content

Commit 61d5e64

Browse files
committed
Fix parser expecting to always find templates
1 parent eed1e38 commit 61d5e64

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/project_parser.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,14 @@ Project::Project(const Project *parent, const std::string &path, bool build) {
428428
}
429429

430430
if (toml.contains("target") || toml.contains("template")) {
431+
const toml::basic_value<toml::discard_comments, tsl::ordered_map, std::vector> empty_templates_table = toml::table();
432+
auto tables = {
433+
toml.contains("template") ? &toml::find(toml, "template") : &empty_templates_table,
434+
&toml::find(toml, "target")
435+
};
431436
auto is_template = true;
432437

433-
for (const auto &ts : {&toml::find(toml, "template"), &toml::find(toml, "target")}) {
438+
for (const auto &ts : tables) {
434439
for (const auto &itr : ts->as_table()) {
435440
const auto &value = itr.second;
436441
auto &t = checker.create(value);

0 commit comments

Comments
 (0)