From fe9b6587a90e79fcc5e23dae2e3e2856b9ec8178 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Sat, 12 Feb 2022 02:07:30 +0100 Subject: [PATCH] Error when trying to parse an empty cmake.toml file --- src/project_parser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/project_parser.cpp b/src/project_parser.cpp index 386b391..696280f 100644 --- a/src/project_parser.cpp +++ b/src/project_parser.cpp @@ -171,9 +171,12 @@ class TomlCheckerRoot { Project::Project(const Project *parent, const std::string &path, bool build) { const auto toml_path = fs::path(path) / "cmake.toml"; if (!fs::exists(toml_path)) { - throw std::runtime_error("No cmake.toml was found!"); + throw std::runtime_error("File not found '" + toml_path.string() + "'"); } const auto toml = toml::parse(toml_path.string()); + if (toml.size() == 0) { + throw std::runtime_error("Empty TOML '" + toml_path.string() + "'"); + } TomlCheckerRoot checker;