about summary refs log tree commit diff
path: root/third_party/nix/src/nix-channel/nix-channel.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/nix-channel/nix-channel.cc')
-rw-r--r--third_party/nix/src/nix-channel/nix-channel.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/third_party/nix/src/nix-channel/nix-channel.cc b/third_party/nix/src/nix-channel/nix-channel.cc
index 837fb861d309..8afdc16ac0d0 100644
--- a/third_party/nix/src/nix-channel/nix-channel.cc
+++ b/third_party/nix/src/nix-channel/nix-channel.cc
@@ -26,14 +26,15 @@ static void readChannels() {
   auto channelsFile = readFile(channelsList);
 
   std::vector<std::string> lines =
-      absl::StrSplit(channelsFile, absl::ByChar('\n'));
+      absl::StrSplit(channelsFile, absl::ByChar('\n'), absl::SkipEmpty());
 
   for (auto& line : lines) {
     line = absl::StripTrailingAsciiWhitespace(line);
     if (std::regex_search(line, std::regex("^\\s*\\#"))) {
       continue;
     }
-    std::vector<std::string> split = absl::StrSplit(line, absl::ByChar(' '));
+    std::vector<std::string> split =
+        absl::StrSplit(line, absl::ByChar(' '), absl::SkipEmpty());
     auto url = std::regex_replace(split[0], std::regex("/*$"), "");
     auto name = split.size() > 1 ? split[1] : baseNameOf(url);
     channels[name] = url;