summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewOverlay.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/view/ViewOverlay.java')
-rw-r--r--core/java/android/view/ViewOverlay.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/view/ViewOverlay.java b/core/java/android/view/ViewOverlay.java
index 78e2597d728c..fe5b99099c1d 100644
--- a/core/java/android/view/ViewOverlay.java
+++ b/core/java/android/view/ViewOverlay.java
@@ -157,7 +157,8 @@ public class ViewOverlay {
public void add(View child) {
if (child.getParent() instanceof ViewGroup) {
ViewGroup parent = (ViewGroup) child.getParent();
- if (parent != mHostView) {
+ if (parent != mHostView && parent.getParent() != null &&
+ parent.mAttachInfo != null) {
// Moving to different container; figure out how to position child such that
// it is in the same location on the screen
int[] parentLocation = new int[2];