aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2007-03-23 09:19:04 +0000
committerJeremias Maerki <jeremias@apache.org>2007-03-23 09:19:04 +0000
commit40b3642340e89fe4b7baf5f4d130f8b34b0eaaf7 (patch)
treeafa7f5ef9bdab388da196bb6d365aae844a8d22a /src
parent962cfdd2171ca49b9815c229c5d1ecf96ca9d92b (diff)
downloadxmlgraphics-fop-40b3642340e89fe4b7baf5f4d130f8b34b0eaaf7.tar.gz
xmlgraphics-fop-40b3642340e89fe4b7baf5f4d130f8b34b0eaaf7.zip
Avoid an IndexOutOfBoundsException when more columns are used than are specified even though this is illegal with fixed table layout.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@521640 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java b/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
index b7f29a744..eb91f7175 100644
--- a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
+++ b/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
@@ -221,8 +221,14 @@ public class ColumnSetup {
public int getXOffset(int col, PercentBaseContext context) {
int xoffset = 0;
for (int i = col; --i >= 0;) {
- if (colWidths.get(i) != null) {
- xoffset += ((Length) colWidths.get(i)).getValue(context);
+ int effCol;
+ if (i < colWidths.size()) {
+ effCol = i;
+ } else {
+ effCol = colWidths.size() - 1;
+ }
+ if (colWidths.get(effCol) != null) {
+ xoffset += ((Length) colWidths.get(effCol)).getValue(context);
}
}
return xoffset;