From 00be416963eb3b4f2bfa6b3779fecd2a5b3bd6a9 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 20 Jun 2005 13:24:21 +0000 Subject: [PATCH] Fixes NPEs when a table is using collapsing border model in conjunction with empty cells. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198755 13f79535-47bb-0310-9956-ffa450edef68 --- .../layoutmgr/table/CollapsingBorderModelEyeCatching.java | 5 +++-- src/java/org/apache/fop/layoutmgr/table/GridUnit.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModelEyeCatching.java b/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModelEyeCatching.java index 98d7fd5bc..d63ba8d48 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModelEyeCatching.java +++ b/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModelEyeCatching.java @@ -96,10 +96,11 @@ public class CollapsingBorderModelEyeCatching extends CollapsingBorderModel { //row other[1] = otherRow.getCommonBorderPaddingBackground().getBorderInfo(otherSide); } - if ((side == BEFORE && currentGridUnit.getFlag(GridUnit.FIRST_IN_BODY)) + if (currentBody != null + && ((side == BEFORE && currentGridUnit.getFlag(GridUnit.FIRST_IN_BODY)) || (side == AFTER && currentGridUnit.getFlag(GridUnit.LAST_IN_BODY)) || (currentGridUnit.getFlag(GridUnit.IN_FIRST_COLUMN) && side == START) - || (currentGridUnit.getFlag(GridUnit.IN_LAST_COLUMN) && side == END)) { + || (currentGridUnit.getFlag(GridUnit.IN_LAST_COLUMN) && side == END))) { //row group (=body, table-header or table-footer) current[2] = currentBody.getCommonBorderPaddingBackground().getBorderInfo(side); } diff --git a/src/java/org/apache/fop/layoutmgr/table/GridUnit.java b/src/java/org/apache/fop/layoutmgr/table/GridUnit.java index fce749863..db381bf87 100644 --- a/src/java/org/apache/fop/layoutmgr/table/GridUnit.java +++ b/src/java/org/apache/fop/layoutmgr/table/GridUnit.java @@ -125,6 +125,9 @@ public class GridUnit { while (node != null && !(node instanceof Table)) { node = node.getParent(); } + if (node == null && getColumn() != null) { + node = getColumn().getParent(); + } return (Table)node; } -- 2.39.5