Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Unified Diff: ui/app_list/views/search_result_view.cc

Issue 120553004: app_list: Fix SearchResultView result_ usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for #2 comment Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/search_result_view.cc
diff --git a/ui/app_list/views/search_result_view.cc b/ui/app_list/views/search_result_view.cc
index ba9575a7e08e470fea9b5c18f89cd057572230a2..8515179da11762374462d7061632fb794f47c418 100644
--- a/ui/app_list/views/search_result_view.cc
+++ b/ui/app_list/views/search_result_view.cc
@@ -172,7 +172,9 @@ void SearchResultView::Layout() {
}
bool SearchResultView::OnKeyPressed(const ui::KeyEvent& event) {
- DCHECK(result_);
+ // |result_| could be NULL when result list is changing.
+ if (!result_)
+ return false;
switch (event.key_code()) {
case ui::VKEY_TAB: {
@@ -304,7 +306,7 @@ void SearchResultView::OnIsInstallingChanged() {
}
void SearchResultView::OnPercentDownloadedChanged() {
- progress_bar_->SetValue(result_->percent_downloaded() / 100.0);
+ progress_bar_->SetValue(result_ ? result_->percent_downloaded() / 100.0 : 0);
}
void SearchResultView::OnItemInstalled() {
@@ -317,7 +319,10 @@ void SearchResultView::OnItemUninstalled() {
void SearchResultView::OnSearchResultActionActivated(size_t index,
int event_flags) {
- DCHECK(result_);
+ // |result_| could be NULL when result list is changing.
+ if (!result_)
+ return;
+
DCHECK_LT(index, result_->actions().size());
delegate_->SearchResultActionActivated(this, index, event_flags);
@@ -326,6 +331,10 @@ void SearchResultView::OnSearchResultActionActivated(size_t index,
void SearchResultView::ShowContextMenuForView(views::View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) {
+ // |result_| could be NULL when result list is changing.
+ if (!result_)
+ return;
+
ui::MenuModel* menu_model = result_->GetContextMenuModel();
if (!menu_model)
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698