diff --git a/src/components/map/ha-location-editor.ts b/src/components/map/ha-location-editor.ts index be72287b3e..a1775f1a58 100644 --- a/src/components/map/ha-location-editor.ts +++ b/src/components/map/ha-location-editor.ts @@ -107,7 +107,7 @@ class LocationEditor extends LitElement { if (changedProps.has("hass")) { const oldHass = changedProps.get("hass") as HomeAssistant | undefined; - if (!oldHass || oldHass.themes.darkMode === this.hass.themes.darkMode) { + if (!oldHass || oldHass.themes?.darkMode === this.hass.themes?.darkMode) { return; } if (!this._leafletMap || !this._tileLayer) { @@ -117,7 +117,7 @@ class LocationEditor extends LitElement { this.Leaflet, this._leafletMap, this._tileLayer, - this.hass.themes.darkMode + this.hass.themes?.darkMode ); } } @@ -129,7 +129,7 @@ class LocationEditor extends LitElement { private async _initMap(): Promise { [this._leafletMap, this.Leaflet, this._tileLayer] = await setupLeafletMap( this._mapEl, - this.hass.themes.darkMode, + this.hass.themes?.darkMode, Boolean(this.radius) ); this._leafletMap.addEventListener(