From: Sergey Vladimirov Date: Tue, 12 Jul 2011 00:37:45 +0000 (+0000) Subject: NPE check X-Git-Tag: REL_3_8_BETA4~201 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=268d7ff219fab2b908a76973664a3091273e2130;p=poi.git NPE check git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145405 13f79535-47bb-0310-9956-ffa450edef68 --- 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 )