Update stats.js

catch exceptions caused by data not formatted properly
This commit is contained in:
hellcatz 2017-04-08 13:33:43 -07:00 committed by GitHub
parent 3aa3176f0e
commit 6f34f9a5fb
1 changed files with 9 additions and 1 deletions

View File

@ -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) {