From 203c45c5ef240176861c6a75de116adf1b248101 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Thu, 2 Jun 2022 17:06:25 -0700 Subject: [PATCH] fix invalid file paths --- src/ui/App.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 147cf29..03b9cf6 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -98,8 +98,12 @@ class App extends React.Component { const isUrl = /^(?:http(s)?:\/\/)/gm.test(custom_bg) if (!isUrl) { + const isValid = await invoke('dir_exists', { + path: custom_bg + }) + this.setState({ - bgFile: convertFileSrc(custom_bg) + bgFile: isValid ? convertFileSrc(custom_bg) : DEFAULT_BG }, this.forceUpdate) } else { // Check if URL returns a valid image.