aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src/main/java/org/apache
diff options
context:
space:
mode:
Diffstat (limited to 'poi-ooxml/src/main/java/org/apache')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
index 27f7dbfaf9..6e590e5f9e 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
@@ -79,10 +79,16 @@ public class XWPFTableCell implements IBody, ICell {
* If a table cell does not include at least one block-level element, then this document shall be considered corrupt
*/
public XWPFTableCell(CTTc cell, XWPFTableRow tableRow, IBody part) {
+ if (cell == null) {
+ throw new IllegalArgumentException("CTTc cannot be null");
+ }
+ if (tableRow == null) {
+ throw new IllegalArgumentException("tableRow cannot be null");
+ }
this.ctTc = cell;
this.part = part;
this.tableRow = tableRow;
- this.xwpfDocument = part.getXWPFDocument();
+ this.xwpfDocument = part == null ? null : part.getXWPFDocument();
bodyElements = new ArrayList<>();
paragraphs = new ArrayList<>();
@@ -530,9 +536,10 @@ public class XWPFTableCell implements IBody, ICell {
return xwpfDocument;
} else if (part instanceof XWPFTableCell) {
return getCellDocument((XWPFTableCell) part, 0);
- } else {
+ } else if (part != null) {
return part.getXWPFDocument();
}
+ return null;
}
private static final int MAX_RECURSION_DEPTH = 1000;