about summary refs log tree commit diff
path: root/third_party/nix/src/nix/doctor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/nix/doctor.cc')
-rw-r--r--third_party/nix/src/nix/doctor.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/third_party/nix/src/nix/doctor.cc b/third_party/nix/src/nix/doctor.cc
index 97c31d0376..0105b05e97 100644
--- a/third_party/nix/src/nix/doctor.cc
+++ b/third_party/nix/src/nix/doctor.cc
@@ -48,7 +48,8 @@ struct CmdDoctor final : StoreCommand {
   static bool checkNixInPath() {
     PathSet dirs;
 
-    for (auto& dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) {
+    for (auto& dir :
+         absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty())) {
       if (pathExists(absl::StrCat(dir, "/nix-env"))) {
         dirs.insert(dirOf(canonPath(absl::StrCat(dir, "/nix-env"), true)));
       }
@@ -71,7 +72,8 @@ struct CmdDoctor final : StoreCommand {
   static bool checkProfileRoots(const ref<Store>& store) {
     PathSet dirs;
 
-    for (auto dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) {
+    for (auto dir :
+         absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty())) {
       Path profileDir = dirOf(dir);
       try {
         Path userEnv = canonPath(profileDir, true);