fix: guard against missing plugin directory in config loads
`find_plugin_dir` can return `None` if a plugin cannot be found. Passing this null value to `files.get_abs_path` caused crashes during config retrieval. `get_plugin_config` and `get_default_plugin_config` now check for a valid directory and return early if it is missing.
Alessandro committed
Apr 1, 2026 at 20:42 UTC
1cccb68d0d48c7ed1c0944df9eb8aa189b3ea162
1 file changed
+9
-6
helpers/plugins.py
+9
-6
@@ -607,9 +607,10 @@ def get_plugin_config(
607
608
# use default config if not found
609
if not file_path:
610
- file_path = files.get_abs_path(
611
- find_plugin_dir(plugin_name), CONFIG_DEFAULT_FILE_NAME
612
- )
610
+ plugin_dir = find_plugin_dir(plugin_name)
611
+ if not plugin_dir:
612
+ return None
613
+ file_path = files.get_abs_path(plugin_dir, CONFIG_DEFAULT_FILE_NAME)
614
default_used = True
615
616
result = None
@@ -635,9 +636,11 @@ def get_plugin_config(
636
637
638
def get_default_plugin_config(plugin_name: str):
638
- file_path = files.get_abs_path(
639
- find_plugin_dir(plugin_name), CONFIG_DEFAULT_FILE_NAME
640
- )
639
+ plugin_dir = find_plugin_dir(plugin_name)
640
+ if not plugin_dir:
641
+ return None
642
+
643
+ file_path = files.get_abs_path(plugin_dir, CONFIG_DEFAULT_FILE_NAME)
644
645
# call plugin hook to get the result
646
result = call_plugin_hook(