diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-05-18 08:59:36 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-05-18 08:59:36 +0000 |
commit | 095b06900c630603280a68b259119a8ae4c93406 (patch) | |
tree | 57a1e3cb3cf7ba5cc06171389cdd4485f95f0fbb /src/java/org/apache | |
parent | e348b4397332cf1e3469c28ab34ebaf35458be14 (diff) | |
download | xmlgraphics-fop-095b06900c630603280a68b259119a8ae4c93406.tar.gz xmlgraphics-fop-095b06900c630603280a68b259119a8ae4c93406.zip |
Handle empty inlines/blocks better.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198647 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java | 5 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/LineLayoutManager.java | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index 6e6e6fdc0..335e882ab 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -232,7 +232,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager // get elements from curLM returnedList = curLM.getNextKnuthElements(childLC, alignment); - if (returnedList.size() == 1 + if (returnedList != null + && returnedList.size() == 1 && ((KnuthElement) returnedList.getFirst()).isPenalty() && ((KnuthPenalty) returnedList.getFirst()).getP() == -KnuthElement.INFINITE) { // a descendant of this block has break-before @@ -281,7 +282,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager // a penalty } } - if (returnedList.size() == 0) { + if (returnedList == null || returnedList.size() == 0) { //Avoid NoSuchElementException below (happens with empty blocks) continue; } diff --git a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java index 79d9b1957..937690b2c 100644 --- a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java @@ -575,6 +575,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager = curLM.getNextKnuthElements(inlineLC, effectiveAlignment)) != null) { + if (returnedList.size() == 0) { + continue; + } // look at the first element thisElement = (KnuthElement) returnedList.getFirst(); if (thisElement.isBox() && !thisElement.isAuxiliary() |