Fix potential NPE when looking up view tags for animating

Test: none / treehugger
Bug: 287395150
Change-Id: I5c4142841115f152070a38ad21a51494cfa7ab0a
This commit is contained in:
Mady Mellor
2023-06-15 17:13:55 -07:00
parent 46d3419bc4
commit f0c64c33b3

View File

@@ -523,6 +523,7 @@ public class PhysicsAnimationLayout extends FrameLayout {
*/
@Nullable private SpringAnimation getSpringAnimationFromView(
DynamicAnimation.ViewProperty property, View view) {
if (view == null) return null;
return (SpringAnimation) view.getTag(getTagIdForProperty(property));
}
@@ -531,11 +532,13 @@ public class PhysicsAnimationLayout extends FrameLayout {
* system.
*/
@Nullable private ViewPropertyAnimator getViewPropertyAnimatorFromView(View view) {
if (view == null) return null;
return (ViewPropertyAnimator) view.getTag(R.id.reorder_animator_tag);
}
/** Retrieves the target animator from the view via the view tag system. */
@Nullable private ObjectAnimator getTargetAnimatorFromView(View view) {
if (view == null) return null;
return (ObjectAnimator) view.getTag(R.id.target_animator_tag);
}