From 29a8646871cd40e7a10ea20cd98df2553dc28d35 Mon Sep 17 00:00:00 2001 From: Zhiting Lin Date: Wed, 20 Feb 2019 11:29:15 +0800 Subject: [PATCH] error handle for empty utxo information --- src/components/layout/profit/action.js | 3 +-- src/components/layout/save/action.js | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/layout/profit/action.js b/src/components/layout/profit/action.js index 5a382b4..39b5217 100644 --- a/src/components/layout/profit/action.js +++ b/src/components/layout/profit/action.js @@ -10,9 +10,8 @@ export function FixedLimitProfit(account, amountBill, saver) { "asset": GetContractArgs().assetDeposited }).then(resp => { - if(resp.length === 0) { + if(!resp) { throw 'cannot load UTXO info.' - return } const capitalAmount = resp.amount diff --git a/src/components/layout/save/action.js b/src/components/layout/save/action.js index e1f6ab5..19ec4fa 100644 --- a/src/components/layout/save/action.js +++ b/src/components/layout/save/action.js @@ -11,6 +11,10 @@ export function FixedLimitDeposit(account, amount, address) { "program": GetContractArgs().depositProgram, "asset": GetContractArgs().assetBill }).then(resp => { + if(!resp) { + throw 'cannot load UTXO info.' + } + const billAmount = resp.amount const billAsset = resp.asset const utxo = resp.hash -- 2.11.0