You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2007/03/01 00:05:11 UTC

svn commit: r513048 - /xmlgraphics/batik/trunk/sources/org/apache/batik/anim/AnimationEngine.java

Author: cam
Date: Wed Feb 28 15:05:11 2007
New Revision: 513048

URL: http://svn.apache.org/viewvc?view=rev&rev=513048
Log:
Fix NPEs that might arise when an attribute becomes unanimated.

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/anim/AnimationEngine.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/anim/AnimationEngine.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/anim/AnimationEngine.java?view=diff&rev=513048&r1=513047&r2=513048
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/anim/AnimationEngine.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/anim/AnimationEngine.java Wed Feb 28 15:05:11 2007
@@ -319,7 +319,7 @@
                     boolean usesUnderlying = false;
                     AbstractAnimation anim = sandwich.animation;
                     if (anim != null) {
-                        av = sandwich.animation.getComposedValue();
+                        av = anim.getComposedValue();
                         usesUnderlying =
                             sandwich.lowestAnimation.usesUnderlyingValue();
                         anim.isDirty = false;
@@ -345,9 +345,15 @@
                 String propertyName = (String) e2.getKey();
                 Sandwich sandwich = (Sandwich) e2.getValue();
                 if (sandwich.shouldUpdate || sandwich.animation.isDirty) {
-                    AnimatableValue av = sandwich.animation.getComposedValue();
-                    boolean usesUnderlying =
-                        sandwich.lowestAnimation.usesUnderlyingValue();
+                    AnimatableValue av = null;
+                    boolean usesUnderlying = false;
+                    AbstractAnimation anim = sandwich.animation;
+                    if (anim != null) {
+                        av = anim.getComposedValue();
+                        usesUnderlying =
+                            sandwich.lowestAnimation.usesUnderlyingValue();
+                        anim.isDirty = false;
+                    }
                     if (usesUnderlying && !sandwich.listenerRegistered) {
                         target.addTargetListener(null, propertyName, true,
                                                  targetListener);
@@ -364,7 +370,6 @@
                         target.updatePropertyValue(propertyName, av);
                     }
                     sandwich.shouldUpdate = false;
-                    sandwich.animation.isDirty = false;
                 }
             }
 
@@ -375,10 +380,14 @@
                 String type = (String) e2.getKey();
                 Sandwich sandwich = (Sandwich) e2.getValue();
                 if (sandwich.shouldUpdate || sandwich.animation.isDirty) {
-                    AnimatableValue av = sandwich.animation.getComposedValue();
+                    AnimatableValue av = null;
+                    AbstractAnimation anim = sandwich.animation;
+                    if (anim != null) {
+                        av = sandwich.animation.getComposedValue();
+                        anim.isDirty = false;
+                    }
                     target.updateOtherValue(type, av);
                     sandwich.shouldUpdate = false;
-                    sandwich.animation.isDirty = false;
                 }
             }
         }