fix failed loading of empty yaml files

This commit is contained in:
Robert Kaussow 2020-01-27 11:03:37 +01:00
parent 850ba35a06
commit 3ab72a32a4
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
* BUGFIX
* add `role_name` config option to overwrite name of the role
* fix not aborting overwrite dialog
* fix failed loading of empty yaml files
* FEATURE
* add basic hugo theme

View File

@ -35,7 +35,7 @@ class Parser:
if any(fnmatch.fnmatch(rfile, "*/defaults/*." + ext) for ext in YAML_EXTENSIONS):
with open(rfile, "r", encoding="utf8") as yaml_file:
try:
data = defaultdict(dict, ruamel.yaml.safe_load(yaml_file))
data = defaultdict(dict, (ruamel.yaml.safe_load(yaml_file) or {}))
for key, value in data.items():
self._data["var"][key] = {"value": {key: value}}
except (ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError) as e: