Prevent NPE when a View is detached without having been attached.

Bug #3355252

Change-Id: I58e03983ccf6a27a24619ec0f49659d6d7cc0a64
This commit is contained in:
Romain Guy
2011-01-14 17:28:51 -08:00
parent c8276990df
commit 8dd5b1e531

View File

@@ -7580,8 +7580,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
mHardwareLayer.destroy();
mHardwareLayer = null;
}
mAttachInfo.mHandler.removeMessages(AttachInfo.INVALIDATE_MSG, this);
mAttachInfo.mHandler.removeMessages(AttachInfo.INVALIDATE_RECT_MSG, this);
if (mAttachInfo != null) {
mAttachInfo.mHandler.removeMessages(AttachInfo.INVALIDATE_MSG, this);
mAttachInfo.mHandler.removeMessages(AttachInfo.INVALIDATE_RECT_MSG, this);
}
mCurrentAnimation = null;
}