diff options
author | Simon Steiner <ssteiner@apache.org> | 2020-01-14 12:07:58 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2020-01-14 12:07:58 +0000 |
commit | fcfcda477575b669e9fd544f44c7a8b1458197e1 (patch) | |
tree | 273ac6f3fbafc91012e1b7fbee68eeccea22b846 /fop-core | |
parent | d3c2f77d295b1f0cb1ba868f46de126fe0f11af1 (diff) | |
download | xmlgraphics-fop-fcfcda477575b669e9fd544f44c7a8b1458197e1.tar.gz xmlgraphics-fop-fcfcda477575b669e9fd544f44c7a8b1458197e1.zip |
FOP-2901: NoSuchElementException on empty table footer
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1872773 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'fop-core')
-rw-r--r-- | fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index 16eba41fa..ad51ba579 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -328,13 +328,15 @@ public class TableContentLayoutManager implements PercentBaseContext { * represent the content. In such a case the break is simply disabled by setting * its penalty to infinite. */ - ListIterator elemIter = returnList.listIterator(returnList.size()); - ListElement elem = (ListElement) elemIter.previous(); - if (elem instanceof KnuthGlue) { - BreakElement breakElement = (BreakElement) elemIter.previous(); - breakElement.setPenaltyValue(KnuthElement.INFINITE); - } else { - elemIter.remove(); + if (!returnList.isEmpty()) { + ListIterator elemIter = returnList.listIterator(returnList.size()); + ListElement elem = (ListElement) elemIter.previous(); + if (elem instanceof KnuthGlue) { + BreakElement breakElement = (BreakElement) elemIter.previous(); + breakElement.setPenaltyValue(KnuthElement.INFINITE); + } else { + elemIter.remove(); + } } context.updateKeepWithPreviousPending(keepWithPrevious); context.setBreakBefore(breakBefore); @@ -483,7 +485,7 @@ public class TableContentLayoutManager implements PercentBaseContext { tableLM.repeatAddAreasForSavedTableHeaderTableCellLayoutManagers(); atLeastOnce = true; - if (footerElements != null) { + if (footerElements != null && !footerElements.isEmpty()) { boolean ancestorTreatAsArtifact = layoutContext.treatAsArtifact(); layoutContext.setTreatAsArtifact(treatFooterAsArtifact); //Positions for footers are simply added at the end |