From ccf2fa00314b91c7d25e0edf48e0e2b51dbc4e63 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 25 Sep 2014 08:33:05 -0700 Subject: [PATCH] Missing null check Bug: 17642023 Change-Id: I874b76e1e184a59dec714191d759c1045b7b9814 --- core/java/android/view/WindowManagerGlobal.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java index 08160c8976a1a..dffcca4152ba7 100644 --- a/core/java/android/view/WindowManagerGlobal.java +++ b/core/java/android/view/WindowManagerGlobal.java @@ -434,11 +434,12 @@ public final class WindowManagerGlobal { boolean hasVisibleWindows = false; synchronized (mLock) { for (int i = mRoots.size() - 1; i >= 0; --i) { - if (mRoots.get(i).getHostVisibility() == View.VISIBLE - && mRoots.get(i).mAttachInfo.mHardwareRenderer != null) { + final ViewRootImpl root = mRoots.get(i); + if (root.mView != null && root.getHostVisibility() == View.VISIBLE + && root.mAttachInfo.mHardwareRenderer != null) { hasVisibleWindows = true; } else { - mRoots.get(i).destroyHardwareResources(); + root.destroyHardwareResources(); } } }