diff options
author | 2020-03-04 01:17:41 +0100 | |
---|---|---|
committer | 2020-03-04 01:17:41 +0100 | |
commit | 445b810e6c47556c67a8dabb0d46b6de150d38d1 (patch) | |
tree | 1df1790d81305813e27270ad836f98c5c507d3ad /src/webview/lib/RecipeWebview.js | |
parent | Add support for unlocking with Touch ID (#423) (diff) | |
download | ferdium-app-445b810e6c47556c67a8dabb0d46b6de150d38d1.tar.gz ferdium-app-445b810e6c47556c67a8dabb0d46b6de150d38d1.tar.zst ferdium-app-445b810e6c47556c67a8dabb0d46b6de150d38d1.zip |
Fix uncaught error on injectCSS that does not exist
Diffstat (limited to 'src/webview/lib/RecipeWebview.js')
-rw-r--r-- | src/webview/lib/RecipeWebview.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/webview/lib/RecipeWebview.js b/src/webview/lib/RecipeWebview.js index 74d05fc2d..68e68e042 100644 --- a/src/webview/lib/RecipeWebview.js +++ b/src/webview/lib/RecipeWebview.js | |||
@@ -68,13 +68,15 @@ class RecipeWebview { | |||
68 | */ | 68 | */ |
69 | injectCSS(...files) { | 69 | injectCSS(...files) { |
70 | files.forEach((file) => { | 70 | files.forEach((file) => { |
71 | const data = fs.readFileSync(file); | 71 | if (fs.existsSync(file)) { |
72 | const styles = document.createElement('style'); | 72 | const data = fs.readFileSync(file); |
73 | styles.innerHTML = data.toString(); | 73 | const styles = document.createElement('style'); |
74 | styles.innerHTML = data.toString(); | ||
74 | 75 | ||
75 | document.querySelector('head').appendChild(styles); | 76 | document.querySelector('head').appendChild(styles); |
76 | 77 | ||
77 | debug('Append styles', styles); | 78 | debug('Append styles', styles); |
79 | } | ||
78 | }); | 80 | }); |
79 | } | 81 | } |
80 | 82 | ||