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 792cdfef7c..e0b3180095 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
@@ -84,6 +84,18 @@ class HuiMediaPlayerEntityRow extends LitElement implements LovelaceRow {
const stateObj = this.hass.states[this._config.entity];
+ if (!stateObj) {
+ return html`
+ ${this.hass.localize(
+ "ui.panel.lovelace.warning.entity_not_found",
+ "entity",
+ this._config.entity
+ )}
+ `;
+ }
+
const buttons = html`
${!this._narrow && supportsFeature(stateObj, SUPPORT_PREVIOUS_TRACK)
? html`
@@ -112,18 +124,6 @@ class HuiMediaPlayerEntityRow extends LitElement implements LovelaceRow {
: ""}
`;
- if (!stateObj) {
- return html`
- ${this.hass.localize(
- "ui.panel.lovelace.warning.entity_not_found",
- "entity",
- this._config.entity
- )}
- `;
- }
-
return html`