Skip to content

Commit

Permalink
[Sync] No-op RecordUserEvent is ModelTypeStore has not initialized.
Browse files Browse the repository at this point in the history
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.

Bug: 748384
Change-Id: Iafeffee0d9bb77b5d539b72992b085d1833015ee
Reviewed-on: https://chromium-review.googlesource.com/584554
Reviewed-by: Patrick Noland <pnoland@chromium.org>
Commit-Queue: Patrick Noland <pnoland@chromium.org>
Commit-Queue: Sky Malice <skym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489385}
  • Loading branch information
Sky Malice authored and Commit Bot committed Jul 25, 2017
1 parent 78c9547 commit 2aa9702
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/sync/user_events/user_event_sync_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ void UserEventSyncBridge::DisableSync() {

void UserEventSyncBridge::RecordUserEvent(
std::unique_ptr<UserEventSpecifics> specifics) {
// TODO(skym): Remove this when ModelTypeStore synchronously returns a
// partially initialized reference, see crbug.com/709094.
if (!store_) {
return;
}
std::string storage_key = GetStorageKeyFromSpecifics(*specifics);

// There are two scenarios we need to guard against here. First, the given
Expand Down

0 comments on commit 2aa9702

Please sign in to comment.