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

fix: check to see if there are any lines before

This commit is contained in:
Tom Bereknyei 2024-08-18 22:35:54 -04:00
parent 1c5ad159d6
commit 59db8fd62b

View file

@ -163,7 +163,7 @@ static void main_nix_build(int argc, char * * argv)
script = argv[1]; script = argv[1];
try { try {
auto lines = tokenizeString<Strings>(readFile(script), "\n"); 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(); lines.pop_front();
inShebang = true; inShebang = true;
for (int i = 2; i < argc; ++i) for (int i = 2; i < argc; ++i)