From 6f34f9a5fb8c7d35b37a1df9ceec2d75a647a11b Mon Sep 17 00:00:00 2001 From: hellcatz Date: Sat, 8 Apr 2017 13:33:43 -0700 Subject: [PATCH] Update stats.js catch exceptions caused by data not formatted properly --- libs/stats.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/stats.js b/libs/stats.js index f8e80cf..2bc6f99 100644 --- a/libs/stats.js +++ b/libs/stats.js @@ -354,7 +354,15 @@ module.exports = function(logger, portalConfig, poolConfigs){ currentRoundShares: replies[i + 8] }; for(var j = replies[i + 10].length; j > 0; j--){ - coinStats.payments.push(JSON.parse(replies[i + 10][j-1])); + var jsonObj; + try { + jsonObj = JSON.parse(replies[i + 10][j-1]); + } catch(e) { + jsonObj = null; + } + if (jsonObj !== null) { + coinStats.payments.push(jsonObj); + } } /* for (var b in coinStats.confirmed.blocks) {