NPE check

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145405 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-12 00:37:45 +00:00
parent c8bb280df0
commit 169018be01
1 changed files with 8 additions and 5 deletions

View File

@ -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 )