Skip to content

Commit ba7379d

Browse files
author
Sky Malice
committed
[Sync] No-op RecordUserEvent is ModelTypeStore has not initialized.
If RecordUserEvent happened before the ModelTypeStore initialized, we would deref null and cause a crash. The other usages of store_ are driven by sync, which shouldn't call into us until we tell sync that we're ready, so they should not need an null check. This fix is ultimately a hack, and can be removed once crbug.com/709094 is done. [email protected] (cherry picked from commit 2aa9702) Bug: 748384 Change-Id: Iafeffee0d9bb77b5d539b72992b085d1833015ee Reviewed-on: https://chromium-review.googlesource.com/584554 Reviewed-by: Patrick Noland <[email protected]> Commit-Queue: Patrick Noland <[email protected]> Commit-Queue: Sky Malice <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#489385} Reviewed-on: https://chromium-review.googlesource.com/587830 Reviewed-by: Sky Malice <[email protected]> Cr-Commit-Position: refs/branch-heads/3163@{#68} Cr-Branched-From: ff259ba-refs/heads/master@{#488528}
1 parent ad74fc6 commit ba7379d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

components/sync/user_events/user_event_sync_bridge.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ void UserEventSyncBridge::DisableSync() {
123123

124124
void UserEventSyncBridge::RecordUserEvent(
125125
std::unique_ptr<UserEventSpecifics> specifics) {
126+
// TODO(skym): Remove this when ModelTypeStore synchronously returns a
127+
// partially initialized reference, see crbug.com/709094.
128+
if (!store_) {
129+
return;
130+
}
126131
std::string storage_key = GetStorageKeyFromSpecifics(*specifics);
127132
std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch();
128133
batch->WriteData(storage_key, specifics->SerializeAsString());

0 commit comments

Comments
 (0)