From 86a1631144e7ad1692284835cb5dcc47e7ee2d10 Mon Sep 17 00:00:00 2001 From: marcdeb1 Date: Mon, 17 Dec 2018 22:36:13 +0100 Subject: [PATCH] Fix index transaction hash bug --- src/Controller/MainController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index fdf30bb..f6fd254 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -96,9 +96,12 @@ class MainController extends AppController { $blocks = $this->Blocks->find()->select(['chainwork', 'confirmations', 'difficulty', 'hash', 'height', 'transaction_hashes', 'block_time', 'block_size'])->order(['height' => 'desc'])->limit(6)->toArray(); for ($i = 0; $i < count($blocks); $i++) { $tx_hashes = json_decode($blocks[$i]->transaction_hashes, true); - $blocks[$i]->transaction_count = count($tx_hashes); + if(!empty($tx_hashes)) { + $blocks[$i]->transaction_count = count($tx_hashes); + } else { + $blocks[$i]->transaction_count = 0; + } } - // hash rate $hashRate = $this->_formatHashRate($this->_gethashrate());