diff --git a/echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SVGOMAnimatedRect.java b/echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SVGOMAnimatedRect.java index 7a0e4258b..1705662f6 100644 --- a/echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SVGOMAnimatedRect.java +++ b/echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SVGOMAnimatedRect.java @@ -126,8 +126,13 @@ protected void updateAnimatedValue(AnimatableValue val) { */ @Override public AnimatableValue getUnderlyingValue(AnimationTarget target) { - SVGRect r = getBaseVal(); - return new AnimatableRectValue(target, r.getX(), r.getY(), r.getWidth(), r.getHeight()); + // Make sure that baseVal exists + getBaseVal(); + + // Calling SVGOMRect.toArray() revalidates only once and narrows the possibility + // of a race condition. + float[] rect = baseVal.toArray(); + return new AnimatableRectValue(target, rect[0], rect[1], rect[2], rect[3]); } /**