1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

Merge pull request #11334 from NixOS/backport-11329-to-2.24-maintenance

[Backport 2.24-maintenance] fix: check to see if there are any lines before
This commit is contained in:
Robert Hensing 2024-08-19 16:38:44 +02:00 committed by GitHub
commit 79a43160ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -163,7 +163,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)