]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Handle empty inlines/blocks better.
authorJeremias Maerki <jeremias@apache.org>
Wed, 18 May 2005 08:59:36 +0000 (08:59 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 18 May 2005 08:59:36 +0000 (08:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198647 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
src/java/org/apache/fop/layoutmgr/LineLayoutManager.java

index 6e6e6fdc07c831ce5a2d0f497b2fd680cf350ee8..335e882ab19cc85603ef329030c7453a3b725a18 100644 (file)
@@ -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;
                 }
index 79d9b19571dccc7769b3bb5a2d8cf9d6496cf8a8..937690b2cb45aa344dd0f353fc47cfff6f8961de 100644 (file)
@@ -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()