Skip to content

Commit

Permalink
Merge pull request #11336 from NixOS/backport-11332-to-2.18-maintenance
Browse files Browse the repository at this point in the history
[Backport 2.18-maintenance] [Backport 2.22-maintenance] fix: check to see if there are any lines before
  • Loading branch information
roberth committed Aug 19, 2024
2 parents 195c3e9 + 0d24420 commit e154f41
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 @@ -119,7 +119,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 e154f41

Please sign in to comment.