fix invalid file paths

This commit is contained in:
SpikeHD
2022-06-02 17:06:25 -07:00
parent 5acd9b54d0
commit 203c45c5ef

View File

@@ -98,8 +98,12 @@ class App extends React.Component<IProps, IState> {
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.