Skip to content

Node.js based forum software built for the modern web

fixed error-report within translator.js

Ole R.22e227a6cd7f
diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js
index ac3be2728e..689f3c8d2e 100644
--- a/public/src/modules/translator.js
+++ b/public/src/modules/translator.js
@@ -283,11 +283,12 @@
}
try {
- callback(JSON.parse(data.toString()));
+ data = JSON.parse(data.toString());
} catch (e) {
winston.error('Could not parse `' + filename + '.json`, syntax error? Skipping...');
- callback({});
+ data = {};
}
+ callback(data);
});
}
@@ -307,4 +308,4 @@
typeof exports === 'object' ? exports :
typeof define === 'function' && define.amd ? {} :
translator = {}
-);
\ No newline at end of file
+);