added null validation for block fetch
This commit is contained in:
parent
71e99fd7db
commit
ba3d418c9b
@ -339,7 +339,7 @@ Node.prototype.setUptime = function()
|
|||||||
|
|
||||||
Node.prototype.formatBlock = function (block)
|
Node.prototype.formatBlock = function (block)
|
||||||
{
|
{
|
||||||
if( !_.isUndefined(block) && !_.isUndefined(block.number) && block.number >= 0 && !_.isUndefined(block.difficulty) && !_.isUndefined(block.totalDifficulty) )
|
if( !_.isNull(block) && !_.isUndefined(block) && !_.isUndefined(block.number) && block.number >= 0 && !_.isUndefined(block.difficulty) && !_.isUndefined(block.totalDifficulty) )
|
||||||
{
|
{
|
||||||
block.difficulty = block.difficulty.toString(10);
|
block.difficulty = block.difficulty.toString(10);
|
||||||
block.totalDifficulty = block.totalDifficulty.toString(10);
|
block.totalDifficulty = block.totalDifficulty.toString(10);
|
||||||
|
Loading…
Reference in New Issue
Block a user