fix: check to see if there are any lines before

(cherry picked from commit 59db8fd62b)
(cherry picked from commit aab801db98)
This commit is contained in:
Tom Bereknyei 2024-08-18 22:35:54 -04:00 committed by github-actions[bot]
parent 45cfd02414
commit bbeaaa3fa3

View File

@ -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)