diff --git a/components/services/bat_ledger/public/interfaces/bat_ledger.mojom b/components/services/bat_ledger/public/interfaces/bat_ledger.mojom index 2e2f55ce4c16..af529a654111 100644 --- a/components/services/bat_ledger/public/interfaces/bat_ledger.mojom +++ b/components/services/bat_ledger/public/interfaces/bat_ledger.mojom @@ -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); diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/wallet/wallet_balance.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/wallet/wallet_balance.cc index e50a1d9ddcae..be029b24cc86 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/wallet/wallet_balance.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/wallet/wallet_balance.cc @@ -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_));