Skip to content

Commit

Permalink
Merge pull request #8143 from /issues/14447-1.22.x
Browse files Browse the repository at this point in the history
Fixed crash when fetching Rewards Widget estimated earnings - 1.22.x
  • Loading branch information
kjozwiak authored Mar 9, 2021
2 parents 677dbc3 + 7b91424 commit 3d5b13d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion browser/extensions/api/brave_rewards_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,9 @@ BraveRewardsGetAdsEstimatedEarningsFunction::Run() {
return RespondNow(Error("Ads service is not initialized"));
}

ads_service_->GetStatement(base::Bind(
AddRef(); // Balanced in OnAdsEstimatedEarnings().

ads_service_->GetStatement(base::BindOnce(
&BraveRewardsGetAdsEstimatedEarningsFunction::OnAdsEstimatedEarnings,
this));
return RespondLater();
Expand All @@ -1151,6 +1153,8 @@ void BraveRewardsGetAdsEstimatedEarningsFunction::OnAdsEstimatedEarnings(
const double earnings_this_month,
const double earnings_last_month) {
Respond(OneArgument(base::Value(estimated_pending_rewards)));

Release(); // Balanced in Run()
}

BraveRewardsGetAdsSupportedFunction::
Expand Down

0 comments on commit 3d5b13d

Please sign in to comment.