summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chromium/base/strings/string_util.h2
-rw-r--r--chromium/components/prefs/json_pref_store.cc8
2 files changed, 8 insertions, 2 deletions
diff --git a/chromium/base/strings/string_util.h b/chromium/base/strings/string_util.h
index 8392c57bec9..40abef2776e 100644
--- a/chromium/base/strings/string_util.h
+++ b/chromium/base/strings/string_util.h
@@ -87,6 +87,8 @@ BASE_EXPORT bool IsWprintfFormatPortable(const wchar_t* format);
template <typename CharT, typename Iter>
constexpr BasicStringPiece<CharT> MakeBasicStringPiece(Iter begin, Iter end) {
DCHECK_GE(end - begin, 0);
+ if (end - begin == 0)
+ return BasicStringPiece<CharT>();
return {base::to_address(begin), static_cast<size_t>(end - begin)};
}
diff --git a/chromium/components/prefs/json_pref_store.cc b/chromium/components/prefs/json_pref_store.cc
index 2f1f2c72fa9..d21899a86ba 100644
--- a/chromium/components/prefs/json_pref_store.cc
+++ b/chromium/components/prefs/json_pref_store.cc
@@ -139,8 +139,12 @@ const char* GetHistogramSuffix(const base::FilePath& path) {
&spaceless_basename);
static constexpr std::array<const char*, 3> kAllowList{
"Secure_Preferences", "Preferences", "Local_State"};
- const char* const* it = base::ranges::find(kAllowList, spaceless_basename);
- return it != kAllowList.end() ? *it : "";
+ for (int i = 0; i < kAllowList.size(); ++i) {
+ if (spaceless_basename == kAllowList[i])
+ return kAllowList[i];
+ }
+
+ return "";
}
} // namespace