diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 4822a5e..8490b11 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -82,7 +82,7 @@ class App extends React.Component { const game_path = game_exe.substring(0, game_exe.replace(/\\/g, '/').lastIndexOf('/')) const root_path = game_path.substring(0, game_path.replace(/\\/g, '/').lastIndexOf('/')) - if(!custom_bg) { + if(!custom_bg || !/png|jpg|jpeg$/.test(custom_bg)) { if(game_path) { // Get the bg by invoking, then set the background to that bg. const bgLoc: string = await invoke('get_bg_file', { diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index de66999..03b8826 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -86,6 +86,8 @@ export default class Options extends React.Component { async setCustomBackground(value: string) { const isUrl = /^(?:http(s)?:\/\/)/gm.test(value) + if (!value) return await setConfigOption('customBackground', '') + if (!isUrl) { const filename = value.replace(/\\/g, '/').split('/').pop() const localBgPath = (await dataDir() as string).replace(/\\/g, '/')