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
pull/15/head
Markus Keil 6 years ago committed by GitHub
parent 6ad9c2cd5e
commit 43b6c7e681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      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

Loading…
Cancel
Save