From fcc2172f1fdee385f06d8555000125d5aded20ca Mon Sep 17 00:00:00 2001 From: grey Date: Wed, 13 Jul 2022 18:24:17 +0200 Subject: [PATCH] fixing config.json not existing causing a crash --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 96e65d5..ca6485b 100644 --- a/index.js +++ b/index.js @@ -58,7 +58,9 @@ currentState = { let configObject = { language: "en_uk" } - +if(!fs.existsSync("config.json")) { + fs.writeFileSync("config.json", "{}"); +} const tempJsonText = JSON.parse(fs.readFileSync("config.json", "utf8")); configObject = _.extend(configObject, tempJsonText); fs.writeFileSync("config.json", JSON.stringify(configObject));