fix(tools_config): guard against None in known_plugin_toolsets config

When config.yaml has known_plugin_toolsets set to null (or any value
mapped to None by the YAML loader), config.get returns None (dict.get
only falls back to the default when the key is absent, not when its
value is None). The subsequent set(known_map.get(platform, [])) then
crashes with TypeError: NoneType object is not iterable and the gateway
fails to start, even though no plugin toolsets are configured.

Add or-empty-dict and or-empty-list guards so a null/None value is
treated as empty instead of crashing the platform-tools resolver.
This commit is contained in:
sonxi 2026-06-27 00:10:08 +08:00 committed by Teknium
parent 5693265775
commit df886d0a45

View file

@ -1830,8 +1830,8 @@ def _get_platform_tools(
# has been saved for that platform (tracked via known_plugin_toolsets).
# Unknown plugins default to enabled; known-but-absent = disabled.
if plugin_ts_keys:
known_map = config.get("known_plugin_toolsets", {})
known_for_platform = set(known_map.get(platform, []))
known_map = config.get("known_plugin_toolsets", {}) or {}
known_for_platform = set(known_map.get(platform, []) or [])
for pts in plugin_ts_keys:
if pts in toolset_names:
# Explicitly listed in config — enabled