tools: handle empty files in the test-svg tool

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-08-22 14:29:36 +10:00
parent cdb7f905ca
commit 06aa5b05b1
1 changed files with 4 additions and 0 deletions

View File

@ -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))