From f4ac547f868db7c8a358e1f6e3d8fcebb02dbd49 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Thu, 27 Jan 2011 10:30:25 -0800 Subject: Fix NPE with display lists when view not attached There was logic in ViewGroup that assumed that an accelerated view must always be able to get a display list for any child that it was drawing. One situation occurred, however, that caused a problem with this - a contacts activity was started and not yet attached, but was being asked to render into an accelerated canvas. We assumed that the child would have a display list and simply called getDisplayList(). But since that call returned null, we later deref'd the null object. The fix is to check whether a child can have a display list instead of assuming that it can just because the container view is accelerated. Change-Id: I7de62fd597ad50720c9585d621bec02e77c171df --- core/java/android/view/ViewGroup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/java/android/view/ViewGroup.java') diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 1313b7815095..d0509b20134a 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2381,7 +2381,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } else if (layerType == LAYER_TYPE_NONE) { // Delay getting the display list until animation-driven alpha values are // set up and possibly passed on to the view - hasDisplayList = true; + hasDisplayList = child.canHaveDisplayList(); } } } -- cgit v1.2.3