Skip to content

Commit

Permalink
Solved invalid JSON conf handling problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ArdaSeremet committed Jul 20, 2020
1 parent ebb3031 commit eb15a01
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit eb15a01

Please sign in to comment.