From 1b723937e3fe4012ac878ded833ff6a39455e0b8 Mon Sep 17 00:00:00 2001 From: stijn Date: Wed, 26 Aug 2020 11:23:10 +0200 Subject: [PATCH] py/makeqstrdefs.py: Fix beaviour when scanning non-C preprocessed files. When process_file() is passed a preprocessed C++ file for instance it won't find any lines containing .c files and the last_fname variable remains None, so handle that gracefully. --- py/makeqstrdefs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py/makeqstrdefs.py b/py/makeqstrdefs.py index 9449a46ee..47afe0adb 100644 --- a/py/makeqstrdefs.py +++ b/py/makeqstrdefs.py @@ -58,7 +58,8 @@ def process_file(f): elif args.mode == _MODE_COMPRESS: output.append(match) - write_out(last_fname, output) + if last_fname: + write_out(last_fname, output) return ""