From 06aa5b05b18731a7edf757675d0cf83e65c70c32 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 22 Aug 2019 14:29:36 +1000 Subject: [PATCH] tools: handle empty files in the test-svg tool Signed-off-by: Peter Hutterer --- tools/test-svg.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/test-svg.py b/tools/test-svg.py index c429924..8aedc6a 100755 --- a/tools/test-svg.py +++ b/tools/test-svg.py @@ -49,6 +49,10 @@ def parse_file(filename, tablet_model, orientation): stem = Path(filename).stem with open(filename) as fd: yml = yaml.load(fd, Loader=yaml.Loader) + if not yml: + print(f'{filename}: empty file.') + return + # all recv lists that have source PEN pendata = [d['recv'] for d in yml['data'] if 'recv' in d and 'source' in d and d['source'] == 'PEN'] data = list(flatten(pendata))