From 470ede29b0555d1ff6c695ee22faa1bc542df190 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Tue, 20 Aug 2002 07:03:19 +0000 Subject: [PATCH] handle errors better git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195108 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/fo/flow/ExternalGraphic.java | 13 ++++++++----- .../apache/fop/fo/flow/InstreamForeignObject.java | 15 +++++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/org/apache/fop/fo/flow/ExternalGraphic.java b/src/org/apache/fop/fo/flow/ExternalGraphic.java index 6f18214d1..5fce31e8c 100644 --- a/src/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/org/apache/fop/fo/flow/ExternalGraphic.java @@ -45,11 +45,14 @@ public class ExternalGraphic extends FObj { } public void addLayoutManager(List list) { - LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this); - lm.setCurrentArea(getInlineArea()); - lm.setAlignment(properties.get("vertical-align").getEnum()); - lm.setLead(viewHeight); - list.add(lm); + InlineArea area = getInlineArea(); + if(area != null) { + LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this); + lm.setCurrentArea(area); + lm.setAlignment(properties.get("vertical-align").getEnum()); + lm.setLead(viewHeight); + list.add(lm); + } } protected InlineArea getInlineArea() { diff --git a/src/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/org/apache/fop/fo/flow/InstreamForeignObject.java index e6da7233c..b39e8c0db 100644 --- a/src/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -54,17 +54,20 @@ public class InstreamForeignObject extends FObj { } public void addLayoutManager(List list) { - LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this); - lm.setCurrentArea(getInlineArea()); - lm.setAlignment(properties.get("vertical-align").getEnum()); - lm.setLead(areaCurrent.getHeight()); - list.add(lm); + areaCurrent = getInlineArea(); + if(areaCurrent != null) { + LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this); + lm.setCurrentArea(areaCurrent); + lm.setAlignment(properties.get("vertical-align").getEnum()); + lm.setLead(areaCurrent.getHeight()); + list.add(lm); + } } /** * Get the inline area created by this element. */ - protected InlineArea getInlineArea() { + protected Viewport getInlineArea() { if (children == null) { return areaCurrent; } -- 2.39.5