From 065e42c8fd0b7c3218edb60b9a9a1ddc7f8724da Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 16 Sep 2019 23:42:25 -0600 Subject: [PATCH] Fix Cast race condition (#3732) --- cast/src/receiver/layout/hc-main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cast/src/receiver/layout/hc-main.ts b/cast/src/receiver/layout/hc-main.ts index bfefc08159..63f0b30fc7 100644 --- a/cast/src/receiver/layout/hc-main.ts +++ b/cast/src/receiver/layout/hc-main.ts @@ -57,7 +57,13 @@ export class HcMain extends HassElement { `; } - if (!this._lovelaceConfig || this._lovelacePath === null) { + if ( + !this._lovelaceConfig || + this._lovelacePath === null || + // Guard against part of HA not being loaded yet. + (this.hass && + (!this.hass.states || !this.hass.config || !this.hass.services)) + ) { return html`