From 0d281f8437baf0af3b6b7da64b483aa94962b23e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Fri, 8 Jan 2021 16:39:55 +0100 Subject: [PATCH] Fix for undefined stateObj in media player row (#8114) --- src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts b/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts index ef7269c43f..eede2497e5 100644 --- a/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts @@ -82,7 +82,6 @@ class HuiMediaPlayerEntityRow extends LitElement implements LovelaceRow { } const stateObj = this.hass.states[this._config.entity] as MediaPlayerEntity; - const state = stateObj.state; if (!stateObj) { return html` @@ -92,6 +91,8 @@ class HuiMediaPlayerEntityRow extends LitElement implements LovelaceRow { `; } + const state = stateObj.state; + const buttons = html` ${!this._narrow && state === "playing" &&