From eb15a01cd6212efb18fa5e44129f891d39d198aa Mon Sep 17 00:00:00 2001 From: Arda Seremet Date: Mon, 20 Jul 2020 21:22:10 +0300 Subject: [PATCH] Solved invalid JSON conf handling problem --- app.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index a18241f..b60811a 100755 --- a/app.js +++ b/app.js @@ -670,10 +670,15 @@ const initData = () => { if(fs.existsSync(_confPath)) { data = fs.readFileSync(_confPath); + try { + ioData = JSON.parse(data); + } catch(e) { + ioData = {}; + } + } else { + ioData = {}; } - ioData = JSON.parse(data); - ioData.initTime = new Date(); if(!ioData.boardName || ioData.boardName == '' || ioData.boardName == null) { ioData.boardName = Math.random().toString(36).slice(2);