Skip to content

Commit

Permalink
Merge pull request #6251 from brave/ksmith-balance-mojom-bug
Browse files Browse the repository at this point in the history
Allow FetchBalance to return an empty ledger::BalancePtr
  • Loading branch information
zenparsing authored Jul 29, 2020
2 parents 4ba0adc + f7375fa commit a06d79b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ interface BatLedger {

GetPendingContributionsTotal() => (double amount);

FetchBalance() => (ledger.mojom.Result result, ledger.mojom.Balance balance);
FetchBalance() => (ledger.mojom.Result result, ledger.mojom.Balance? balance);

GetExternalWallet(string wallet_type) => (ledger.mojom.Result result, ledger.mojom.ExternalWallet? wallet);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ void WalletBalance::Fetch(ledger::FetchBalanceCallback callback) {
}

const std::string payment_id = braveledger_state::GetPaymentId(ledger_);
if (payment_id.empty()) {
BLOG(0, "Payment ID is empty");
callback(ledger::Result::LEDGER_ERROR, nullptr);
return;
}

const std::string url = braveledger_request_util::GetBalanceWalletURL(
braveledger_state::GetPaymentId(ledger_));
Expand Down

0 comments on commit a06d79b

Please sign in to comment.