Fix crash in ChromeZoomLevelPrefs::ExtractPerHostZoomLevels().
This CL fixes a crash that occurs when ExtractPerHostZoomLevels is
called with a legacy per-host zoom level dictionary. In this case the
sanitization code will fail to find a partition key and subsequently
dereference a null pointer.
Since the legacy dictionary will be deleted immediately after the
function exits, we just skip the sanitization in this case.
BUG=424540
Review URL: https://codereview.chromium.org/665283002
Cr-Commit-Position: refs/heads/master@{#300501}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index fd84b269..874b3ef 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -687,7 +687,10 @@
migrated |= !host_zoom_dictionary->empty();
UMA_HISTOGRAM_BOOLEAN("Settings.ZoomLevelPreferencesMigrated", migrated);
- zoom_level_prefs->ExtractPerHostZoomLevels(host_zoom_dictionary);
+ // Since |host_zoom_dictionary| is not partition-based, do not attempt to
+ // sanitize it.
+ zoom_level_prefs->ExtractPerHostZoomLevels(
+ host_zoom_dictionary, false /* sanitize_partition_host_zoom_levels */);
// We're done migrating the profile per-host zoom level values, so we clear
// them all.