Fix resize observer on error card (#5158)

* Fix resize observer on error card

* Update hui-media-control-card.ts
This commit is contained in:
Bram Kragten 2020-03-12 20:09:27 +01:00 committed by GitHub
parent 73e0fd614e
commit f54cd18da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -521,7 +521,12 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
debounce(() => this._measureCard(), 250, false)
);
this._resizeObserver.observe(this.shadowRoot!.querySelector("ha-card")!);
const card = this.shadowRoot!.querySelector("ha-card");
// If we show an error or warning there is no ha-card
if (!card) {
return;
}
this._resizeObserver.observe(card);
}
private _handleMoreInfo(): void {