From 71cfcb2c1fee2f67f1fc7b53cfc01bd488473582 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 12:17:08 +0000 Subject: [PATCH 1/2] Initial plan From 848056e8dfe54b127275e0fafc3fb4c778dbf47d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 12:18:54 +0000 Subject: [PATCH 2/2] Add error handling to get_available_geoids filesystem iteration Co-authored-by: michalpelka <3209244+michalpelka@users.noreply.github.com> --- _codeql_detected_source_root | 1 + core/src/gnss.cpp | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/core/src/gnss.cpp b/core/src/gnss.cpp index 8cd1ffb9..f6a3df13 100644 --- a/core/src/gnss.cpp +++ b/core/src/gnss.cpp @@ -30,11 +30,24 @@ std::vector GNSS::get_available_geoids() for (const auto& path : PathCandidate) { std::filesystem::path proj_path(path); - if (std::filesystem::exists(proj_path)) + std::error_code ec; + if (std::filesystem::exists(proj_path, ec) && !ec) { - for (const auto& entry : std::filesystem::directory_iterator(proj_path)) + std::filesystem::directory_iterator dir_it(proj_path, ec); + if (ec) { - if (entry.is_regular_file() && entry.path().extension() == ".gtx") + std::cerr << "cannot open directory " << proj_path << ": " << ec.message() << std::endl; + continue; + } + for (; dir_it != std::filesystem::directory_iterator(); dir_it.increment(ec)) + { + if (ec) + { + std::cerr << "error iterating directory " << proj_path << ": " << ec.message() << std::endl; + break; + } + const auto& entry = *dir_it; + if (entry.is_regular_file(ec) && !ec && entry.path().extension() == ".gtx") { std::cout << "found geoid model: " << entry.path().filename().string() << std::endl; unique.insert(entry.path().filename().string());