Skip to content

Commit fe9b658

Browse files
committed
Error when trying to parse an empty cmake.toml file
1 parent a2f8d9e commit fe9b658

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/project_parser.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,12 @@ class TomlCheckerRoot {
171171
Project::Project(const Project *parent, const std::string &path, bool build) {
172172
const auto toml_path = fs::path(path) / "cmake.toml";
173173
if (!fs::exists(toml_path)) {
174-
throw std::runtime_error("No cmake.toml was found!");
174+
throw std::runtime_error("File not found '" + toml_path.string() + "'");
175175
}
176176
const auto toml = toml::parse<toml::discard_comments, tsl::ordered_map, std::vector>(toml_path.string());
177+
if (toml.size() == 0) {
178+
throw std::runtime_error("Empty TOML '" + toml_path.string() + "'");
179+
}
177180

178181
TomlCheckerRoot checker;
179182

0 commit comments

Comments
 (0)