From: Zhiting Lin Date: Wed, 20 Feb 2019 03:29:15 +0000 (+0800) Subject: error handle for empty utxo information X-Git-Url: http://git.osdn.net/view?p=bytom%2FBytom-Dapp-Demo.git;a=commitdiff_plain;h=29a8646871cd40e7a10ea20cd98df2553dc28d35 error handle for empty utxo information --- 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