Merge "Fix crash when handling recents animation canceled" into sc-dev
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index e867f07..7e45369 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -387,8 +387,11 @@
         mGestureState.runOnceAtState(STATE_RECENTS_ANIMATION_CANCELED, () -> {
                 ThumbnailData snapshot = mGestureState.consumeRecentsAnimationCanceledSnapshot();
                 if (snapshot != null) {
-                    mRecentsView.switchToScreenshot(snapshot,
-                            () -> mRecentsAnimationController.cleanupScreenshot());
+                    mRecentsView.switchToScreenshot(snapshot, () -> {
+                        if (mRecentsAnimationController != null) {
+                            mRecentsAnimationController.cleanupScreenshot();
+                        }
+                    });
                     mRecentsView.onRecentsAnimationComplete();
                 }
             });