OSDN Git Service

Fix NPE in TaskSnapshotController
authorJorim Jaggi <jjaggi@google.com>
Tue, 11 Apr 2017 22:50:19 +0000 (15:50 -0700)
committerJorim Jaggi <jjaggi@google.com>
Tue, 11 Apr 2017 22:50:58 +0000 (15:50 -0700)
Test: Pray
Change-Id: Ie65f072b35fbf1a9a65caf5be48dabbb7abb6be8
Fixes: 36592724

services/core/java/com/android/server/wm/TaskSnapshotController.java

index 48b01f4..fbb826d 100644 (file)
@@ -162,12 +162,15 @@ class TaskSnapshotController {
         if (top == null) {
             return null;
         }
+        final WindowState mainWindow = top.findMainWindow();
+        if (mainWindow == null) {
+            return null;
+        }
         final GraphicBuffer buffer = top.mDisplayContent.screenshotApplicationsToBuffer(top.token,
                 -1, -1, false, 1.0f, false, true);
         if (buffer == null) {
             return null;
         }
-        final WindowState mainWindow = top.findMainWindow();
         return new TaskSnapshot(buffer, top.getConfiguration().orientation,
                 minRect(mainWindow.mContentInsets, mainWindow.mStableInsets), false /* reduced */,
                 1f /* scale */);