Merge "Prevent NPE in layer assignment, not all windows have a stack."
diff --git a/services/core/java/com/android/server/wm/WindowLayersController.java b/services/core/java/com/android/server/wm/WindowLayersController.java
index 4a77b22..9af3eb3 100644
--- a/services/core/java/com/android/server/wm/WindowLayersController.java
+++ b/services/core/java/com/android/server/wm/WindowLayersController.java
@@ -159,6 +159,9 @@
             mDockDivider = w;
         } else {
             final TaskStack stack = w.getStack();
+            if (stack == null) {
+                return;
+            }
             if (stack.mStackId == StackId.PINNED_STACK_ID) {
                 mPinnedWindow = w;
             } else if (stack.mStackId == StackId.DOCKED_STACK_ID) {