From 22e227a6cd7f916f3511a2f32ecade000f4e9675 Mon Sep 17 00:00:00 2001 From: "Ole R." Date: Thu, 21 May 2015 15:38:19 +0200 Subject: [PATCH] fixed error-report within translator.js reported by [rex-huang](https://community.nodebb.org/user/rex-huang), see https://community.nodebb.org/topic/4520/error-handling-is-wrong-in-translator-js --- public/src/modules/translator.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 +);