Index: chrome/browser/prefs/pref_metrics_service.cc |
diff --git a/chrome/browser/prefs/pref_metrics_service.cc b/chrome/browser/prefs/pref_metrics_service.cc |
index 803e5a773807787baf76e2dcccf0900898397379..13129b54a42cf663318d09da209051e74c20d84e 100644 |
--- a/chrome/browser/prefs/pref_metrics_service.cc |
+++ b/chrome/browser/prefs/pref_metrics_service.cc |
@@ -354,10 +354,12 @@ std::string PrefMetricsService::GetHashedPrefValue( |
// Dictionary values may contain empty lists and sub-dictionaries. Create |
// a deep copy with those stripped to make the hash more stable. |
- DictionaryValue* dict_value = |
- static_cast<DictionaryValue*>(const_cast<Value*>(value)); |
- if (dict_value) |
- value = dict_value->DeepCopyWithoutEmptyChildren(); |
+ scoped_ptr<DictionaryValue> dict_value; |
+ if (value->IsType(Value::TYPE_DICTIONARY)) { |
+ dict_value.reset(static_cast<const DictionaryValue*>(value) |
+ ->DeepCopyWithoutEmptyChildren()); |
+ value = dict_value.get(); |
+ } |
std::string string_to_hash(device_id_); |
string_to_hash.append(path); |