From 0d26b9e73912dc202b4bbaeba502064a288715ee Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Fri, 23 Feb 2001 03:47:08 +0000 Subject: [PATCH] makes checks to prevent exceptions git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194084 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/dom/svg/SVGDocumentImpl.java | 4 +++- src/org/apache/fop/fo/FObj.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/apache/fop/dom/svg/SVGDocumentImpl.java b/src/org/apache/fop/dom/svg/SVGDocumentImpl.java index 70be48f48..66e613507 100644 --- a/src/org/apache/fop/dom/svg/SVGDocumentImpl.java +++ b/src/org/apache/fop/dom/svg/SVGDocumentImpl.java @@ -102,7 +102,9 @@ public class SVGDocumentImpl extends ElementImpl implements SVGDocument { public SVGSVGElement getRootElement() { - return (SVGSVGElement)childs.elementAt(0); + if(childs.size() > 0) + return (SVGSVGElement)childs.elementAt(0); + return null; } public Element getElementById(String elementId) diff --git a/src/org/apache/fop/fo/FObj.java b/src/org/apache/fop/fo/FObj.java index cd3746a84..2011ef140 100644 --- a/src/org/apache/fop/fo/FObj.java +++ b/src/org/apache/fop/fo/FObj.java @@ -165,6 +165,8 @@ public class FObj extends FONode { */ public void removeID(IDReferences idReferences) { + if(((FObj)this).properties.get("id") == null) + return; idReferences.removeID( ((FObj)this).properties.get("id").getString()); int numChildren = this.children.size(); for (int i = 0; i < numChildren; i++) -- 2.39.5