OSDN Git Service

Allow null target in ObjectAnimator if the target has never been set
authorDoris Liu <tianliu@google.com>
Mon, 26 Sep 2016 22:12:46 +0000 (15:12 -0700)
committerDoris Liu <tianliu@google.com>
Mon, 26 Sep 2016 22:32:41 +0000 (22:32 +0000)
BUG: 31684571
Test: http://ag/1484115

Change-Id: I867fc3f93ddf70c58ae4387317ac875c5bafbebe

core/java/android/animation/ObjectAnimator.java

index 9a2aa30..0c21c4f 100644 (file)
@@ -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;
         }