Index: ui/app_list/views/apps_grid_view.cc |
diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc |
index 5a620a6270152c26c6b3aaf8ed0ec9a953d12074..e30092b639fd06ffbd76d2fcc116f991b9e253b5 100644 |
--- a/ui/app_list/views/apps_grid_view.cc |
+++ b/ui/app_list/views/apps_grid_view.cc |
@@ -1671,6 +1671,11 @@ void AppsGridView::ReparentItemToAnotherFolder(views::View* item_view, |
const Index& target) { |
DCHECK(IsDraggingForReparentInRootLevelGridView()); |
+ AppListItemView* target_view = |
+ static_cast<AppListItemView*>(GetViewAtSlotOnCurrentPage(target.slot)); |
+ if (!target_view) |
+ return; |
+ |
// Make change to data model. |
item_list_->RemoveObserver(this); |
@@ -1686,8 +1691,6 @@ void AppsGridView::ReparentItemToAnotherFolder(views::View* item_view, |
if (source_folder->ChildItemCount() == 1u) |
DeleteItemViewAtIndex(view_model_.GetIndexOfView(activated_item_view())); |
- AppListItemView* target_view = |
- static_cast<AppListItemView*>(GetViewAtSlotOnCurrentPage(target.slot)); |
AppListItem* target_item = target_view->item(); |
// Move item to the target folder. |