From 1babbc0c92314c037569cf18ba3d96a074ddb079 Mon Sep 17 00:00:00 2001 From: Cary R Date: Sun, 21 Jun 2026 22:50:14 -0700 Subject: [PATCH] Fix segmentation fault when the input file is missing --- ivlpp/lexor.lex | 4 ++-- main.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index 6da2aaafe..a1d64dea3 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -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); diff --git a/main.cc b/main.cc index 917e006e9..563fd8bcc 100644 --- a/main.cc +++ b/main.cc @@ -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; }