diff --git a/scripts/convert.py b/scripts/convert.py index 3f60754fc..fef9a9bae 100644 --- a/scripts/convert.py +++ b/scripts/convert.py @@ -636,6 +636,9 @@ def get_mapping_data_for_edition( with open(mappingfile, "r", encoding="utf-8") as f: try: data = yaml.safe_load(f) + # Handle empty/null YAML files and validate it's a dict + if not isinstance(data, dict): + data = {} except yaml.YAMLError as e: logging.info(f"Error loading yaml file: {mappingfile}. Error = {e}") data = {} @@ -737,6 +740,9 @@ def get_language_data( with open(language_file, "r", encoding="utf-8") as f: try: data = yaml.safe_load(f) + # Handle empty/null YAML files and validate it's a dict + if not isinstance(data, dict): + data = {} except yaml.YAMLError as e: logging.error(f"Error loading yaml file: {language_file}. Error = {e}") data = {}