1
mirror of https://github.com/home-assistant/core synced 2024-07-18 12:02:20 +02:00

Fix reloading themes crashing if no themes configured (#73287)

This commit is contained in:
Paulus Schoutsen 2022-06-09 12:46:13 -07:00 committed by GitHub
parent 82afbd1d12
commit f25fdf0d2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -460,7 +460,7 @@ async def _async_setup_themes(
async def reload_themes(_: ServiceCall) -> None:
"""Reload themes."""
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
if hass.data[DATA_DEFAULT_THEME] not in new_themes:
hass.data[DATA_DEFAULT_THEME] = DEFAULT_THEME