Commit 44df4a90 authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

app_list: Fix SearchResultView result_ usage.

SearchResultView's |result_| could be NULL and should be handled properly.

BUG=332012

Review URL: https://codereview.chromium.org/120553004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243602 0039d316-1c4b-4281-b951-d872f2087c98
parent 33977db3
...@@ -172,7 +172,9 @@ void SearchResultView::Layout() { ...@@ -172,7 +172,9 @@ void SearchResultView::Layout() {
} }
bool SearchResultView::OnKeyPressed(const ui::KeyEvent& event) { 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()) { switch (event.key_code()) {
case ui::VKEY_TAB: { case ui::VKEY_TAB: {
...@@ -304,7 +306,7 @@ void SearchResultView::OnIsInstallingChanged() { ...@@ -304,7 +306,7 @@ void SearchResultView::OnIsInstallingChanged() {
} }
void SearchResultView::OnPercentDownloadedChanged() { void SearchResultView::OnPercentDownloadedChanged() {
progress_bar_->SetValue(result_->percent_downloaded() / 100.0); progress_bar_->SetValue(result_ ? result_->percent_downloaded() / 100.0 : 0);
} }
void SearchResultView::OnItemInstalled() { void SearchResultView::OnItemInstalled() {
...@@ -317,7 +319,10 @@ void SearchResultView::OnItemUninstalled() { ...@@ -317,7 +319,10 @@ void SearchResultView::OnItemUninstalled() {
void SearchResultView::OnSearchResultActionActivated(size_t index, void SearchResultView::OnSearchResultActionActivated(size_t index,
int event_flags) { int event_flags) {
DCHECK(result_); // |result_| could be NULL when result list is changing.
if (!result_)
return;
DCHECK_LT(index, result_->actions().size()); DCHECK_LT(index, result_->actions().size());
delegate_->SearchResultActionActivated(this, index, event_flags); delegate_->SearchResultActionActivated(this, index, event_flags);
...@@ -326,6 +331,10 @@ void SearchResultView::OnSearchResultActionActivated(size_t index, ...@@ -326,6 +331,10 @@ void SearchResultView::OnSearchResultActionActivated(size_t index,
void SearchResultView::ShowContextMenuForView(views::View* source, void SearchResultView::ShowContextMenuForView(views::View* source,
const gfx::Point& point, const gfx::Point& point,
ui::MenuSourceType source_type) { ui::MenuSourceType source_type) {
// |result_| could be NULL when result list is changing.
if (!result_)
return;
ui::MenuModel* menu_model = result_->GetContextMenuModel(); ui::MenuModel* menu_model = result_->GetContextMenuModel();
if (!menu_model) if (!menu_model)
return; return;
......
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