summaryrefslogtreecommitdiff
path: root/modules/zelfoverhoor
diff options
context:
space:
mode:
Diffstat (limited to 'modules/zelfoverhoor')
-rw-r--r--modules/zelfoverhoor/zelfoverhoor.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/zelfoverhoor/zelfoverhoor.js b/modules/zelfoverhoor/zelfoverhoor.js
index 03de63c..0acb322 100644
--- a/modules/zelfoverhoor/zelfoverhoor.js
+++ b/modules/zelfoverhoor/zelfoverhoor.js
@@ -6,7 +6,12 @@ var moddir;
var dbdir=cmn.persistdir+"/zelfoverhoor";
mkdirp.sync(dbdir);
-var accounts=require("./accounts.json");
+var accounts=null;
+try {
+ accounts=require("./accounts.json");
+} catch (e) {
+ console.error(e);
+}
var SHUFFLE_QUESTIONS=false;
@@ -97,6 +102,9 @@ function canAccessFile(fname){
module.exports=function(app,io,_moddir){
moddir=_moddir;
+ // Failed to load accounts.json
+ if(accounts==null)return false;
+
if(canAccessFile(dbdir+"/questiondb.json")&&canAccessFile(dbdir+"/questionsets.json")&&canAccessFile(dbdir+"/userlists.json")){
questiondb=JSON.parse(fs.readFileSync(dbdir+"/questiondb.json"));
questionsets=JSON.parse(fs.readFileSync(dbdir+"/questionsets.json"));