Skip to content

Commit

Permalink
Merge pull request #3590 from brave/fix-p3a-dcheck-error
Browse files Browse the repository at this point in the history
Account for initial run having a null value
  • Loading branch information
yrliou authored Oct 3, 2019
2 parents 5524e2d + 2af7a57 commit d17efcf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions components/p3a/brave_p3a_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,15 @@ void BraveP3AService::Init() {
// Do rotation if needed.
const base::Time last_rotation =
local_state_->GetTime(kLastRotationTimeStampPref);
const base::TimeDelta last_rotation_interval =
rotation_interval_.is_zero() ? TimeDeltaTillMonday(last_rotation)
: rotation_interval_;
if (base::Time::Now() - last_rotation > last_rotation_interval) {
if (last_rotation.is_null()) {
DoRotation();
} else {
const base::TimeDelta last_rotation_interval =
rotation_interval_.is_zero() ? TimeDeltaTillMonday(last_rotation)
: rotation_interval_;
if (base::Time::Now() - last_rotation > last_rotation_interval) {
DoRotation();
}
}

// Init other components.
Expand Down

0 comments on commit d17efcf

Please sign in to comment.