Skip to content

Commit

Permalink
fix: check to see if there are any lines before
Browse files Browse the repository at this point in the history
  • Loading branch information
tomberek committed Aug 19, 2024
1 parent 1c5ad15 commit 59db8fd
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 @@ -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)
Expand Down

0 comments on commit 59db8fd

Please sign in to comment.