From 4d04b1a446cb8c3dc5b42ddd58f82a6127521622 Mon Sep 17 00:00:00 2001 From: Doris Liu Date: Mon, 26 Sep 2016 15:12:46 -0700 Subject: [PATCH] Allow null target in ObjectAnimator if the target has never been set BUG: 31684571 Test: http://ag/1484115 Change-Id: I867fc3f93ddf70c58ae4387317ac875c5bafbebe --- core/java/android/animation/ObjectAnimator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/java/android/animation/ObjectAnimator.java b/core/java/android/animation/ObjectAnimator.java index 9a2aa302a4baf..0c21c4ff55e7a 100644 --- a/core/java/android/animation/ObjectAnimator.java +++ b/core/java/android/animation/ObjectAnimator.java @@ -977,8 +977,9 @@ public final class ObjectAnimator extends ValueAnimator { @Override void animateValue(float fraction) { final Object target = getTarget(); - if (target == null) { - // We lost the target reference, cancel and clean up. + if (mTarget != null && target == null) { + // We lost the target reference, cancel and clean up. Note: we allow null target if the + /// target has never been set. cancel(); return; }