From 42b0e873936b51b6eb2670f0c0fa8e75138c6f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Mon, 2 Aug 2021 22:30:46 +0200 Subject: [PATCH] import-scripts: fix IndexError for options with no declarations (#330) --- import-scripts/import_scripts/channel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/import-scripts/import_scripts/channel.py b/import-scripts/import_scripts/channel.py index 7f4c21f..fe18b3e 100644 --- a/import-scripts/import_scripts/channel.py +++ b/import-scripts/import_scripts/channel.py @@ -552,6 +552,9 @@ def get_options(evaluation): option_name_query = parse_query(name) + declarations = option.get("declarations", []) + option_source = declarations[0] if declarations else None + yield dict( type="option", option_name=name, @@ -563,7 +566,7 @@ def get_options(evaluation): option_type=option.get("type"), option_default=default, option_example=example, - option_source=option.get("declarations", [None])[0], + option_source=option_source, ) return len(options), gen