Ignore JSON.parse expections on PermissionManager constructor
https://github.com/mattermost/desktop/pull/633#issuecomment-342508014
This commit is contained in:
@@ -9,7 +9,12 @@ class PermissionManager {
|
|||||||
constructor(file) {
|
constructor(file) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
if (fs.existsSync(file)) {
|
if (fs.existsSync(file)) {
|
||||||
this.permissions = JSON.parse(fs.readFileSync(this.file, 'utf-8'));
|
try {
|
||||||
|
this.permissions = JSON.parse(fs.readFileSync(this.file, 'utf-8'));
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
this.permissions = {};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.permissions = {};
|
this.permissions = {};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user