Skip to content

Commit

Permalink
Merge pull request #11337 from NixOS/backport-11332-to-2.19-maintenance
Browse files Browse the repository at this point in the history
[Backport 2.19-maintenance] [Backport 2.22-maintenance] fix: check to see if there are any lines before
  • Loading branch information
roberth authored Aug 19, 2024
2 parents 8c4d8e1 + 763af31 commit 3df4dba
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 @@ -133,7 +133,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 3df4dba

Please sign in to comment.