Skip to content

Commit

Permalink
Add guard for rate when there is no live price
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl authored May 31, 2022
1 parent f032cf4 commit 43066e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/masternodes/rpc_vault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ namespace {
if (verbose) {
useNextPrice = true;
auto rate = pcustomcsview->GetLoanCollaterals(vaultId, *collaterals, height + 1, blockTime, useNextPrice, requireLivePrice);
nextCollateralRatio = int(rate.val->ratio());
result.pushKV("nextCollateralRatio", nextCollateralRatio);
if (rate) {
nextCollateralRatio = int(rate.val->ratio());
result.pushKV("nextCollateralRatio", nextCollateralRatio);
}
}
return result;
}
Expand Down

0 comments on commit 43066e0

Please sign in to comment.