mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
fix: Handle None value for feeds config to prevent TypeError
Fix crash when plugin_config['feeds'] exists but is None, causing
TypeError when checking 'custom_feeds' in feeds_config.
Problem:
- When plugin_config['feeds'] exists but is None, dict.get('feeds', {})
returns None (not the default {}) because dict.get() only uses default
when key doesn't exist, not when value is None
- Line 3642's 'custom_feeds' in feeds_config raises TypeError because
None is not iterable
- This can crash the API endpoint if a plugin config has feeds: null
Solution:
- Change plugin_config.get('feeds', {}) to plugin_config.get('feeds') or {}
to ensure feeds_config is always a dict (never None)
- Add feeds_config check before 'in' operator for extra safety
This ensures the code gracefully handles feeds: null in plugin configuration.
This commit is contained in:
@@ -3638,8 +3638,8 @@ def save_plugin_config():
|
||||
|
||||
# Force fix for feeds.custom_feeds if it's still a dict (fallback)
|
||||
if 'feeds' in plugin_config:
|
||||
feeds_config = plugin_config.get('feeds', {})
|
||||
if 'custom_feeds' in feeds_config and isinstance(feeds_config['custom_feeds'], dict):
|
||||
feeds_config = plugin_config.get('feeds') or {}
|
||||
if feeds_config and 'custom_feeds' in feeds_config and isinstance(feeds_config['custom_feeds'], dict):
|
||||
custom_feeds_dict = feeds_config['custom_feeds']
|
||||
# Check if all keys are numeric
|
||||
keys = list(custom_feeds_dict.keys())
|
||||
|
||||
Reference in New Issue
Block a user