Skip to content

Commit

Permalink
Check if attached on rebuild (#5918)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed May 18, 2020
1 parent a0e2cc7 commit 91b0bd5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/panels/lovelace/cards/hui-stack-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ export abstract class HuiStackCard extends LitElement implements LovelaceCard {
config: LovelaceCardConfig
): void {
const newCardEl = this._createCardElement(config);
cardElToReplace.parentElement!.replaceChild(newCardEl, cardElToReplace);
if (cardElToReplace.parentElement) {
cardElToReplace.parentElement.replaceChild(newCardEl, cardElToReplace);
}
this._cards = this._cards!.map((curCardEl) =>
curCardEl === cardElToReplace ? newCardEl : curCardEl
);
Expand Down

0 comments on commit 91b0bd5

Please sign in to comment.