From 8a0fbed3633feab538c2951856d0022b4266bd0d Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Fri, 3 Nov 2000 05:16:12 +0000 Subject: [PATCH] fixes npe when rendering, checks the correct length thing for val git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193743 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/svg/SVG.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/org/apache/fop/svg/SVG.java b/src/org/apache/fop/svg/SVG.java index 4ecc8587a..99df234ce 100644 --- a/src/org/apache/fop/svg/SVG.java +++ b/src/org/apache/fop/svg/SVG.java @@ -120,22 +120,26 @@ public class SVG extends FObj implements GraphicsCreator { getSVGLength(); svgArea = new SVGSVGElementImpl(); SVGAnimatedLength sal; + if (w == null) + w = new SVGLengthImpl(); sal = new SVGAnimatedLengthImpl(w); sal.setBaseVal(w); svgArea.setWidth(sal); + if (h == null) + h = new SVGLengthImpl(); sal = new SVGAnimatedLengthImpl(h); sal.setBaseVal(h); svgArea.setHeight(sal); - SVGLengthProperty lengthProp = - (SVGLengthProperty) this.properties.get("x"); - SVGLength x = lengthProp == null ? new SVGLengthImpl() : - lengthProp.getSVGLength(); + SVGLength lengthProp = + ((SVGLengthProperty) this.properties.get("x")). + getSVGLength(); + SVGLength x = lengthProp == null ? new SVGLengthImpl() : lengthProp; sal = new SVGAnimatedLengthImpl(x); sal.setBaseVal(x); svgArea.setX(sal); - lengthProp = (SVGLengthProperty) this.properties.get("y"); - SVGLength y = lengthProp == null ? new SVGLengthImpl() : - lengthProp.getSVGLength(); + lengthProp = ((SVGLengthProperty) this.properties.get("y")). + getSVGLength(); + SVGLength y = lengthProp == null ? new SVGLengthImpl() : lengthProp; sal = new SVGAnimatedLengthImpl(y); sal.setBaseVal(y); svgArea.setY(sal); -- 2.39.5