Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Add undefined check for ll.lovelace and ll.lovelace.config (#41)
Browse files Browse the repository at this point in the history
An attempt to resolve #39 and #37. It seems like there are cases when ll.lovelace is undefined which leads to uncaught TypeError:
kiosk-mode.js:18:15 Uncaught TypeError: Cannot read property 'config' of undefined

It seems thought that code is expecting similar situations to happen already and adding additional conditions is a safe fix.
  • Loading branch information
gigz authored Dec 31, 2020
1 parent 78b95f3 commit 0bd19bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kiosk-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ function getConfig() {
llAttempts++
setTimeout(() => getConfig(), 50)
}
return ll && ll.lovelace.config.kiosk_mode ? ll.lovelace.config.kiosk_mode : {};
return ll && ll.lovelace && ll.lovelace.config && ll.lovelace.config.kiosk_mode
? ll.lovelace.config.kiosk_mode
: {};
}

// Return true if any keyword is found in location.
Expand Down

0 comments on commit 0bd19bd

Please sign in to comment.