From 43b6c7e681920ed607532dde8342c5c26d5bc73d Mon Sep 17 00:00:00 2001 From: Markus Keil Date: Thu, 21 Feb 2019 20:52:04 +0100 Subject: [PATCH] Harden against missing transactions property Should fix this: 2019-02-21 19:40:46.825 [API] [BLK] Block: 119134 td: 205248 from: blockchainsLlcPantheon ip: 10.240.0.7 2019-02-21 19:40:46.866 [API] [BLK] Block: 119137 td: 205254 from: Mudit-node-1 ip: 10.240.0.7 2019-02-21 19:40:46.867 [API] [STA] Stats from: Mudit-node-1 /app/ethstats-server/lib/history.js:609 transactions: item.block.transactions.length, ^ TypeError: Cannot read property 'length' of null --- lib/history.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/history.js b/lib/history.js index decfa7d..b238271 100644 --- a/lib/history.js +++ b/lib/history.js @@ -606,7 +606,7 @@ History.prototype.getCharts = function() blocktime: item.block.time / 1000, difficulty: item.block.difficulty, uncles: item.block.uncles.length, - transactions: item.block.transactions.length, + transactions: item.block.transactions ? item.block.transactions.length : 0, gasSpending: item.block.gasUsed, gasLimit: item.block.gasLimit, miner: item.block.miner