Commit c639169e authored by Florian Uunk's avatar Florian Uunk Committed by Commit Bot

Properly handle unknown WalletInfoType values.

The previous DCHECK meant that we can't introduce a new type in the
future without breaking old clients. Instead, just ignore types we
don't know about.

Bug: 864428
Change-Id: Iaa31e2b0e6d501e14fcc1fa840110fc22f5c100a
Reviewed-on: https://chromium-review.googlesource.com/1140058Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarSebastien Seguin-Gagnon <sebsg@chromium.org>
Commit-Queue: Florian Uunk <feuunk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575680}
parent 2758f8e3
......@@ -273,19 +273,22 @@ void AutofillWalletSyncableService::PopulateWalletCardsAndAddresses(
DCHECK_EQ(syncer::AUTOFILL_WALLET_DATA, data.GetDataType());
const sync_pb::AutofillWalletSpecifics& autofill_specifics =
data.GetSpecifics().autofill_wallet();
if (autofill_specifics.type() ==
sync_pb::AutofillWalletSpecifics::MASKED_CREDIT_CARD) {
wallet_cards->push_back(
CardFromSpecifics(autofill_specifics.masked_card()));
} else {
DCHECK_EQ(sync_pb::AutofillWalletSpecifics::POSTAL_ADDRESS,
autofill_specifics.type());
wallet_addresses->push_back(
ProfileFromSpecifics(autofill_specifics.address()));
// Map the sync billing address id to the profile's id.
ids[autofill_specifics.address().id()] =
wallet_addresses->back().server_id();
switch (autofill_specifics.type()) {
case sync_pb::AutofillWalletSpecifics::MASKED_CREDIT_CARD:
wallet_cards->push_back(
CardFromSpecifics(autofill_specifics.masked_card()));
break;
case sync_pb::AutofillWalletSpecifics::POSTAL_ADDRESS:
wallet_addresses->push_back(
ProfileFromSpecifics(autofill_specifics.address()));
// Map the sync billing address id to the profile's id.
ids[autofill_specifics.address().id()] =
wallet_addresses->back().server_id();
break;
case sync_pb::AutofillWalletSpecifics::UNKNOWN:
// Just ignore new entry types that the client doesn't know about.
break;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment