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
This commit is contained in:
Markus Keil 2019-02-21 20:52:04 +01:00 committed by GitHub
parent 6ad9c2cd5e
commit 43b6c7e681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -606,7 +606,7 @@ History.prototype.getCharts = function()
blocktime: item.block.time / 1000, blocktime: item.block.time / 1000,
difficulty: item.block.difficulty, difficulty: item.block.difficulty,
uncles: item.block.uncles.length, uncles: item.block.uncles.length,
transactions: item.block.transactions.length, transactions: item.block.transactions ? item.block.transactions.length : 0,
gasSpending: item.block.gasUsed, gasSpending: item.block.gasUsed,
gasLimit: item.block.gasLimit, gasLimit: item.block.gasLimit,
miner: item.block.miner miner: item.block.miner