diff options
-rw-r--r-- | slicer/tool/slicer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/slicer/tool/slicer.cpp b/slicer/tool/slicer.cpp index 1a83519..a4439cb 100644 --- a/slicer/tool/slicer.cpp +++ b/slicer/tool/slicer.cpp @@ -29,7 +29,12 @@ defaultPostProcessor() constexpr std::array<const std::pair<std::string_view, std::string_view>, 1> pps {{ {"clang-format", "-i"}, }}; - const std::string_view path {getenv("PATH")}; + const auto path {[]() -> std::string_view { + if (auto p = getenv("PATH")) { + return p; + } + return ""; + }()}; const auto pathBegin = make_split_iterator(path, first_finder(":", boost::is_equal())); for (const auto & [cmd, opts] : pps) { for (auto p = pathBegin; p != decltype(pathBegin) {}; ++p) { |