Check for invalid JSON

This commit is contained in:
Natsumi
2021-05-10 23:48:56 +12:00
parent 11693db8b6
commit 2c3485058e

View File

@@ -10919,11 +10919,19 @@ speechSynthesis.getVoices();
dynamic_bone_max_collider_check_count: { name: 'Dynamic Bones Limit Max Collider Collisions (0 disables all components)', default: '8' }
};
$app.methods.ReadVRChatConfigFile = async function () {
$app.methods.readVRChatConfigFile = async function () {
this.VRChatConfigFile = {};
var config = await AppApi.ReadConfigFile();
if (config) {
this.VRChatConfigFile = JSON.parse(config);
try {
this.VRChatConfigFile = JSON.parse(config);
} catch {
this.$message({
message: 'Invalid JSON in config.json',
type: 'error'
});
throw new Error('Invalid JSON in config.json');
}
}
};
@@ -10932,7 +10940,6 @@ speechSynthesis.getVoices();
AppApi.WriteConfigFile(json);
};
$app.data.VRChatConfigDialog = {
visible: false,
cameraRes: false,
@@ -10944,7 +10951,7 @@ speechSynthesis.getVoices();
});
$app.methods.showVRChatConfig = async function () {
await this.ReadVRChatConfigFile();
await this.readVRChatConfigFile();
this.$nextTick(() => adjustDialogZ(this.$refs.VRChatConfigDialog.$el));
this.VRChatConfigDialog = {
cameraRes: false,