Commit b13ae184 authored by Rachel Wong's avatar Rachel Wong Committed by Chromium LUCI CQ

Handle an edge case to prevent a possible crash while logging.

UMA logging checks that enum values are strictly less than the specified
max value.

Bug: 1159285
Change-Id: I94b12b272c51d3c73285446807ab5aa57b07d9b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596729
Commit-Queue: Rachel Wong <wrong@chromium.org>
Commit-Queue: Tony Yeoman <tby@chromium.org>
Reviewed-by: default avatarTony Yeoman <tby@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837935}
parent 42ec88d1
......@@ -60,6 +60,13 @@ void LogTypeAction(const std::string& histogram_prefix,
ash::AppListNotifier::Location location,
const base::string16& query,
const SearchMetricsObserver::Result& result) {
if (result.type == ash::SEARCH_RESULT_TYPE_BOUNDARY) {
// TODO(crbug.com/1159285): The boundary value is the default value for
// result types, but results should have a non-default type. In any case,
// return here to prevent a crash from logging the boundary value.
return;
}
const std::string histogram_name = base::StrCat(
{histogram_prefix, ".", GetHistogramSuffix(location, query)});
base::UmaHistogramEnumeration(histogram_name, result.type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment