Skip to content

Commit c0f0b30

Browse files
committed
Add null check for config in getCardSize and connectedCallback methods
1 parent bea8524 commit c0f0b30

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lawn-mower-card",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"type": "module",
55
"description": "Lawn Mower cleaner card for Home Assistant Lovelace UI",
66
"main": "dist/lawn-mower-card.js",

src/lawn-mower-card.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ export class LawnMowerCard extends LitElement {
8484
}
8585

8686
public getCardSize(): number {
87+
if (!this.config) {
88+
return 3;
89+
}
8790
return this.config.compact_view ? 3 : 8;
8891
}
8992

@@ -106,6 +109,9 @@ export class LawnMowerCard extends LitElement {
106109

107110
public connectedCallback() {
108111
super.connectedCallback();
112+
if (!this.config) {
113+
return;
114+
}
109115
if (!this.config.compact_view && this.map) {
110116
this.requestUpdate();
111117
this.thumbUpdater = setInterval(

0 commit comments

Comments
 (0)