| Index: chrome/browser/ui/app_list/search/app_search_provider.cc
|
| diff --git a/chrome/browser/ui/app_list/search/app_search_provider.cc b/chrome/browser/ui/app_list/search/app_search_provider.cc
|
| index b81afa693e3c73a6c31565274c3f14b41eee3799..5009b3aaad9aaff9d2cb7af5a3bf7561dde5f12c 100644
|
| --- a/chrome/browser/ui/app_list/search/app_search_provider.cc
|
| +++ b/chrome/browser/ui/app_list/search/app_search_provider.cc
|
| @@ -112,9 +112,16 @@ void AppSearchProvider::UpdateResults() {
|
|
|
| // Use the app list order to tiebreak apps that have never been launched.
|
| if (app->last_launch_time().is_null()) {
|
| - result->set_relevance(
|
| - kUnlaunchedAppRelevanceStepSize *
|
| - (apps_.size() - id_to_app_list_index[app->app_id()]));
|
| + auto it = id_to_app_list_index.find(app->app_id());
|
| + // If it's in a folder, it won't be in |id_to_app_list_index|. Rank
|
| + // those as if they are at the end of the list.
|
| + size_t app_list_index =
|
| + it == id_to_app_list_index.end() ? apps_.size() : (*it).second;
|
| + if (app_list_index > apps_.size())
|
| + app_list_index = apps_.size();
|
| +
|
| + result->set_relevance(kUnlaunchedAppRelevanceStepSize *
|
| + (apps_.size() - app_list_index));
|
| } else {
|
| result->UpdateFromLastLaunched(clock_->Now(), app->last_launch_time());
|
| }
|
|
|