Commit 9cf67d23 authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

[multi-profile]Speculative fix for crash while loading AppList search

Either we are attempting to emplace() past the last element of the
vector, or the index is negative somehow. Fix the first condition and
check for the second.

Bug: 992344
Change-Id: Id3f6a71a9d5ab3ad41079f9ed1fa7067238faae8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761295
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarMatthew Mourgos <mmourgos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688279}
parent 0749890d
......@@ -300,9 +300,12 @@ std::vector<SearchResult*> SearchResultTileItemListView::GetDisplayResults() {
return r1->display_index() < r2->display_index();
});
for (auto* result : policy_tiles_results) {
if (result->display_index() > display_results.size() - 1) {
if (result->display_index() >= display_results.size() - 1) {
display_results.emplace_back(result);
} else {
// TODO(newcomer): Remove this check once we determine the root cause for
// https://crbug.com/992344.
CHECK_GT(result->display_index(), -1);
display_results.emplace(display_results.begin() + result->display_index(),
result);
}
......
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