[go: up one dir, main page]

CrOS: Speculative fix for AppListView crash during Tablet transition

It seems like the button is being pressed during the transition, but
before the AppListView is constructed. In tablet mode we assume that the
AppListView exists, but it is not neccesarily true at the beginning.

(cherry picked from commit df8f5bb7882323336c41b487b3e8124bd87aa4b5)

Bug: 969844
Change-Id: I332abe4e7d330bccad7d9c51c3cd3d49fa683513
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1659353
Reviewed-by: Jenny Zhang <jennyz@chromium.org>
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#669298}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1663051
Reviewed-by: Alex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/branch-heads/3809@{#379}
Cr-Branched-From: d82dec1a818f378c464ba307ddd9c92133eac355-refs/heads/master@{#665002}
diff --git a/ash/app_list/app_list_controller_impl.cc b/ash/app_list/app_list_controller_impl.cc
index 15384ec..5f82b6e 100644
--- a/ash/app_list/app_list_controller_impl.cc
+++ b/ash/app_list/app_list_controller_impl.cc
@@ -1383,6 +1383,11 @@
 void AppListControllerImpl::NotifyHomeLauncherAnimationTransition(
     AnimationTrigger trigger,
     bool launcher_will_show) {
+  // The AppListView may not exist if this is happening after tablet mode
+  // has started, but before the view is created.
+  if (!presenter_.GetView())
+    return;
+
   presenter_.GetView()->OnTabletModeAnimationTransitionNotified(
       CalculateAnimationTransitionForMetrics(trigger, launcher_will_show));
 }