Guard against null parent in Launcher2.Search.clearAnimation()
Sometimes clearAnimation() is called on the search widget
when it has no parent, e.g. when it being removed from the
home screen. This caused an NPE, because clearAnimation()
called invalidate() on the parent.
This is a partial fix for: http://b/issue?id=2246760
diff --git a/src/com/android/launcher2/Search.java b/src/com/android/launcher2/Search.java
index f963048..283042d 100644
--- a/src/com/android/launcher2/Search.java
+++ b/src/com/android/launcher2/Search.java
@@ -253,7 +253,8 @@
if (animation.hasEnded()
&& animation.getFillAfter()
&& animation.willChangeBounds()) {
- ((View) getParent()).invalidate();
+ View parent = (View) getParent();
+ if (parent != null) parent.invalidate();
} else {
invalidate();
}