Fix segmentation fault when the input file is missing

This commit is contained in:
Cary R 2026-06-21 22:50:14 -07:00
parent e9bc3488fb
commit 1babbc0c92
2 changed files with 3 additions and 3 deletions

View File

@ -2368,6 +2368,8 @@ void reset_lexor(FILE* out, char* paths[])
isp->stringify_flag = 0;
isp->comment = NULL;
yyout = out;
if (isp->file == 0) {
perror(paths[0]);
error_count += 1;
@ -2382,8 +2384,6 @@ void reset_lexor(FILE* out, char* paths[])
}
}
yyout = out;
yyrestart(isp->file);
assert(istack == 0);

View File

@ -1215,7 +1215,7 @@ int main(int argc, char*argv[])
if (pre_process_fail_count) {
cerr << "Preprocessor failed with " << pre_process_fail_count
<< " errors." << endl;
<< " error(s)." << endl;
return pre_process_fail_count;
}