mirror of
https://github.com/home-assistant/core
synced 2024-09-03 08:14:07 +02:00
Fix reloading themes crashing if no themes configured (#73287)
This commit is contained in:
parent
82afbd1d12
commit
f25fdf0d2e
@ -460,7 +460,7 @@ async def _async_setup_themes(
|
|||||||
async def reload_themes(_: ServiceCall) -> None:
|
async def reload_themes(_: ServiceCall) -> None:
|
||||||
"""Reload themes."""
|
"""Reload themes."""
|
||||||
config = await async_hass_config_yaml(hass)
|
config = await async_hass_config_yaml(hass)
|
||||||
new_themes = config[DOMAIN].get(CONF_THEMES, {})
|
new_themes = config.get(DOMAIN, {}).get(CONF_THEMES, {})
|
||||||
hass.data[DATA_THEMES] = new_themes
|
hass.data[DATA_THEMES] = new_themes
|
||||||
if hass.data[DATA_DEFAULT_THEME] not in new_themes:
|
if hass.data[DATA_DEFAULT_THEME] not in new_themes:
|
||||||
hass.data[DATA_DEFAULT_THEME] = DEFAULT_THEME
|
hass.data[DATA_DEFAULT_THEME] = DEFAULT_THEME
|
||||||
|
Loading…
Reference in New Issue
Block a user