diff --git a/components/brave_ads/core/internal/legacy_migration/confirmations/legacy_confirmation_migration.cc b/components/brave_ads/core/internal/legacy_migration/confirmations/legacy_confirmation_migration.cc index 32a74c51c4d2..706284347523 100644 --- a/components/brave_ads/core/internal/legacy_migration/confirmations/legacy_confirmation_migration.cc +++ b/components/brave_ads/core/internal/legacy_migration/confirmations/legacy_confirmation_migration.cc @@ -46,7 +46,7 @@ void MigrateConfirmationState(InitializeCallback callback) { [](InitializeCallback callback, const std::optional& json) { if (!json) { - // Confirmation state does not exist + // Confirmation state does not exist. return SuccessfullyMigrated(std::move(callback)); } @@ -63,7 +63,11 @@ void MigrateConfirmationState(InitializeCallback callback) { const absl::optional confirmations = json::reader::ReadConfirmations(*json); - CHECK(confirmations); + if (!confirmations) { + // Confirmation queue state does not exist. + return SuccessfullyMigrated(std::move(callback)); + } + ConfirmationQueueItemList confirmation_queue_items; for (const auto& confirmation : *confirmations) { const ConfirmationQueueItemInfo confirmation_queue_item = diff --git a/components/brave_ads/core/internal/legacy_migration/confirmations/legacy_confirmation_migration_confirmations_json_reader_util.cc b/components/brave_ads/core/internal/legacy_migration/confirmations/legacy_confirmation_migration_confirmations_json_reader_util.cc index c126bf6ee5c4..a4cb84121d8d 100644 --- a/components/brave_ads/core/internal/legacy_migration/confirmations/legacy_confirmation_migration_confirmations_json_reader_util.cc +++ b/components/brave_ads/core/internal/legacy_migration/confirmations/legacy_confirmation_migration_confirmations_json_reader_util.cc @@ -136,6 +136,8 @@ std::optional ParseConfirmation( // User data if (const auto* const value = dict.FindDict(kConfirmationUserDataKey)) { confirmation.user_data.fixed = value->Clone(); + } else { + return std::nullopt; } // Reward