diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index a29cf13f4ef86..28e44856f0e8b 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2824,6 +2824,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager if (hasDisplayList) { displayList = child.getDisplayList(); + if (!displayList.isValid()) { + // Uncommon, but possible. If a view is removed from the hierarchy during the call + // to getDisplayList(), the display list will be marked invalid and we should not + // try to use it again. + displayList = null; + hasDisplayList = false; + } } if (hasNoCache) {