diff options
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() |