From 268d7ff219fab2b908a76973664a3091273e2130 Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Tue, 12 Jul 2011 00:37:45 +0000 Subject: [PATCH] NPE check git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145405 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hwpf/usermodel/TableRow.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java index 16a2967bbb..0d861dac86 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java @@ -174,12 +174,15 @@ public final class TableRow extends Range cells.add( tableCell ); } - TableCell lastCell = cells.get( cells.size() - 1 ); - if ( lastCell.numParagraphs() == 1 - && ( lastCell.getParagraph( 0 ).isTableRowEnd() ) ) + if ( !cells.isEmpty() ) { - // remove "fake" cell - cells.remove( cells.size() - 1 ); + TableCell lastCell = cells.get( cells.size() - 1 ); + if ( lastCell.numParagraphs() == 1 + && ( lastCell.getParagraph( 0 ).isTableRowEnd() ) ) + { + // remove "fake" cell + cells.remove( cells.size() - 1 ); + } } if ( cells.size() != expectedCellsCount ) -- 2.39.5