Fix trying to open nonexistant config

If you try to open settings, or change the
"Toggle Encryption" toggle, while GC's server
config does not exist it no longer throws an
error message.
This commit is contained in:
fnrir
2023-06-27 10:50:55 +02:00
parent 3ba467d03b
commit b9b0929668

View File

@@ -99,10 +99,13 @@ export default class Options extends React.Component<IProps, IState> {
const languages = await getLanguages()
const platform: string = await invoke('get_platform')
// Remove jar from path
const path = config.grasscutter_path.replace(/\\/g, '/')
const folderPath = path.substring(0, path.lastIndexOf('/'))
const encEnabled = await server.encryptionEnabled(folderPath + '/config.json')
let encEnabled
if (config.grasscutter_path) {
// Remove jar from path
const path = config.grasscutter_path.replace(/\\/g, '/')
const folderPath = path.substring(0, path.lastIndexOf('/'))
encEnabled = await server.encryptionEnabled(folderPath + '/config.json')
}
console.log(platform)