From 4298f701ebaef10b6692c16d65979b825ee0503f Mon Sep 17 00:00:00 2001 From: fuwa Date: Tue, 23 Jul 2019 18:32:36 +0000 Subject: [PATCH] fix empty transaction list --- cyberwow/lib/controller/rpc.dart | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/cyberwow/lib/controller/rpc.dart b/cyberwow/lib/controller/rpc.dart index 674eb76..1e5f86a 100644 --- a/cyberwow/lib/controller/rpc.dart +++ b/cyberwow/lib/controller/rpc.dart @@ -200,14 +200,19 @@ Future> getTransactionPoolSimple() async { } else { final responseBody = json.decode(response.body); var result = responseBody['transactions']; - result.forEach - ( - (tx) { - tx.remove('tx_blob'); - tx.remove('tx_json'); - tx.remove('last_failed_id_hash'); - } - ); - return result; + if (result == null) { + return []; + } + else { + result.forEach + ( + (tx) { + tx.remove('tx_blob'); + tx.remove('tx_json'); + tx.remove('last_failed_id_hash'); + } + ); + return result; + } } }