Merge "Allow null target in ObjectAnimator if the target has never been set" into nyc-mr1-dev

This commit is contained in:
TreeHugger Robot
2016-09-27 00:38:00 +00:00
committed by Android (Google) Code Review

View File

@@ -977,8 +977,9 @@ public final class ObjectAnimator extends ValueAnimator {
@Override @Override
void animateValue(float fraction) { void animateValue(float fraction) {
final Object target = getTarget(); final Object target = getTarget();
if (target == null) { if (mTarget != null && target == null) {
// We lost the target reference, cancel and clean up. // We lost the target reference, cancel and clean up. Note: we allow null target if the
/// target has never been set.
cancel(); cancel();
return; return;
} }