Skip to content

Commit

Permalink
Merge pull request #11339 from NixOS/backport-11332-to-2.21-maintenance
Browse files Browse the repository at this point in the history
[Backport 2.21-maintenance] [Backport 2.22-maintenance] fix: check to see if there are any lines before
  • Loading branch information
tomberek authored Aug 20, 2024
2 parents a4c9218 + 1842768 commit 2046691
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nix-build/nix-build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static void main_nix_build(int argc, char * * argv)
script = argv[1];
try {
auto lines = tokenizeString<Strings>(readFile(script), "\n");
if (std::regex_search(lines.front(), std::regex("^#!"))) {
if (!lines.empty() && std::regex_search(lines.front(), std::regex("^#!"))) {
lines.pop_front();
inShebang = true;
for (int i = 2; i < argc; ++i)
Expand Down

0 comments on commit 2046691

Please sign in to comment.